mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: Allow View.setBounds to animate (#48812)
* feat: allow View::SetBounds to animate * fix: support width/height animations * fix: jumping on subsequent animations * fix: segfault race condition * fix: remove layer background * fix: layer clips not being reset * refactor: use gfx tween gin converter * fix: layer cleanups causing flickering views * chore: merge artifact * fix: missing private method in header * fix: return type * fix: do not set layer opacity * refactor: update animate parameter format * refactor: move animate into options object * chore: typo * docs: update * spec: add view animation test
This commit is contained in:
@@ -133,5 +133,18 @@ describe('View', () => {
|
||||
parent.setBounds({ x: 50, y: 60, width: 500, height: 600 });
|
||||
expect(child.getBounds()).to.deep.equal({ x: 10, y: 15, width: 25, height: 30 });
|
||||
});
|
||||
|
||||
it('can set bounds with animation', (done) => {
|
||||
const v = new View();
|
||||
v.setBounds({ x: 0, y: 0, width: 100, height: 100 }, {
|
||||
animate: {
|
||||
duration: 300
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
expect(v.getBounds()).to.deep.equal({ x: 0, y: 0, width: 100, height: 100 });
|
||||
done();
|
||||
}, 350);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user