Allow FLIP animations perform correctly in scaled parent

- get the scale factor by comparing against node.clientWidth
- divide all the positions/dimensions by the scale to get the correct
deltas

- resolves #7205
- fixes regression from #6658
pull/7207/head
simeydotme 5 years ago
parent 2f71bc9333
commit 385737ad9f

@ -21,8 +21,12 @@ export function flip(node: Element, { from, to }: { from: DOMRect; to: DOMRect }
const transform = style.transform === 'none' ? '' : style.transform;
const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat);
const dx = (from.left + from.width * ox / to.width) - (to.left + ox);
const dy = (from.top + from.height * oy / to.height) - (to.top + oy);
const scale = {
x: to.width / node.clientWidth,
y: to.height / node.clientHeight
};
const dx = ((from.left / scale.x) + (from.width / scale.x) * ox / (to.width / scale.x)) - ((to.left / scale.x) + ox);
const dy = ((from.top / scale.y) + (from.height / scale.y) * oy / (to.height / scale.y)) - ((to.top / scale.y) + oy);
const {
delay = 0,

Loading…
Cancel
Save