framer-motion 5.0.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/gestures/drag/VisualElementDragControls.mjs +15 -1
- package/dist/es/motion/utils/valid-prop.mjs +1 -0
- package/dist/es/render/dom/utils/unit-conversion.mjs +9 -8
- package/dist/es/render/svg/config-motion.mjs +0 -6
- package/dist/es/render/svg/utils/build-attrs.mjs +4 -4
- package/dist/es/render/svg/utils/camel-case-attrs.mjs +1 -0
- package/dist/es/render/svg/utils/path.mjs +6 -8
- package/dist/es/render/utils/animation-state.mjs +1 -1
- package/dist/es/render/utils/variants.mjs +19 -3
- package/dist/framer-motion.cjs.js +53 -30
- package/dist/framer-motion.dev.js +106 -42
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +61 -19
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-m.js +1 -1
- package/package.json +7 -6
- package/types/render/dom/utils/unit-conversion.d.ts +6 -0
- package/types/render/svg/types.d.ts +0 -4
- package/types/render/svg/utils/path.d.ts +1 -1
- package/types/types.d.ts +1 -1
- package/dist/size-webpack-dom-animation.js +0 -1
- package/dist/size-webpack-dom-max.js +0 -2
- package/dist/size-webpack-dom-max.js.LICENSE.txt +0 -14
- package/dist/size-webpack-m.js +0 -2
- package/dist/size-webpack-m.js.LICENSE.txt +0 -14
|
@@ -14,6 +14,8 @@ import { startAnimation } from '../../animation/utils/transitions.mjs';
|
|
|
14
14
|
import { convertBoxToBoundingBox, convertBoundingBoxToBox } from '../../projection/geometry/conversion.mjs';
|
|
15
15
|
import { addDomEvent } from '../../events/use-dom-event.mjs';
|
|
16
16
|
import { mix } from 'popmotion';
|
|
17
|
+
import { percent } from 'style-value-types';
|
|
18
|
+
import { calcLength } from '../../projection/geometry/delta-calc.mjs';
|
|
17
19
|
|
|
18
20
|
var elementDragControls = new WeakMap();
|
|
19
21
|
/**
|
|
@@ -79,7 +81,19 @@ var VisualElementDragControls = /** @class */ (function () {
|
|
|
79
81
|
* Record gesture origin
|
|
80
82
|
*/
|
|
81
83
|
eachAxis(function (axis) {
|
|
82
|
-
|
|
84
|
+
var _a, _b;
|
|
85
|
+
var current = _this.getAxisMotionValue(axis).get() || 0;
|
|
86
|
+
/**
|
|
87
|
+
* If the MotionValue is a percentage value convert to px
|
|
88
|
+
*/
|
|
89
|
+
if (percent.test(current)) {
|
|
90
|
+
var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
|
|
91
|
+
if (measuredAxis) {
|
|
92
|
+
var length_1 = calcLength(measuredAxis);
|
|
93
|
+
current = length_1 * (parseFloat(current) / 100);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
_this.originPoint[axis] = current;
|
|
83
97
|
});
|
|
84
98
|
// Fire onDragStart event
|
|
85
99
|
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, info);
|
|
@@ -78,13 +78,15 @@ function removeNonTranslationalTransform(visualElement) {
|
|
|
78
78
|
}
|
|
79
79
|
var positionalValues = {
|
|
80
80
|
// Dimensions
|
|
81
|
-
width: function (_a) {
|
|
81
|
+
width: function (_a, _b) {
|
|
82
82
|
var x = _a.x;
|
|
83
|
-
|
|
83
|
+
var _c = _b.paddingLeft, paddingLeft = _c === void 0 ? "0" : _c, _d = _b.paddingRight, paddingRight = _d === void 0 ? "0" : _d;
|
|
84
|
+
return x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
84
85
|
},
|
|
85
|
-
height: function (_a) {
|
|
86
|
+
height: function (_a, _b) {
|
|
86
87
|
var y = _a.y;
|
|
87
|
-
|
|
88
|
+
var _c = _b.paddingTop, paddingTop = _c === void 0 ? "0" : _c, _d = _b.paddingBottom, paddingBottom = _d === void 0 ? "0" : _d;
|
|
89
|
+
return y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom);
|
|
88
90
|
},
|
|
89
91
|
top: function (_bbox, _a) {
|
|
90
92
|
var top = _a.top;
|
|
@@ -112,8 +114,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
|
|
|
112
114
|
var originBbox = visualElement.measureViewportBox();
|
|
113
115
|
var element = visualElement.getInstance();
|
|
114
116
|
var elementComputedStyle = getComputedStyle(element);
|
|
115
|
-
var display = elementComputedStyle.display
|
|
116
|
-
var originComputedStyle = { top: top, left: left, bottom: bottom, right: right, transform: transform };
|
|
117
|
+
var display = elementComputedStyle.display;
|
|
117
118
|
// If the element is currently set to display: "none", make it visible before
|
|
118
119
|
// measuring the target bounding box
|
|
119
120
|
if (display === "none") {
|
|
@@ -126,7 +127,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
|
|
|
126
127
|
// Restore styles to their **calculated computed style**, not their actual
|
|
127
128
|
// originally set style. This allows us to animate between equivalent pixel units.
|
|
128
129
|
var value = visualElement.getValue(key);
|
|
129
|
-
setAndResetVelocity(value, positionalValues[key](originBbox,
|
|
130
|
+
setAndResetVelocity(value, positionalValues[key](originBbox, elementComputedStyle));
|
|
130
131
|
target[key] = positionalValues[key](targetBbox, elementComputedStyle);
|
|
131
132
|
});
|
|
132
133
|
return target;
|
|
@@ -247,4 +248,4 @@ function unitConversion(visualElement, target, origin, transitionEnd) {
|
|
|
247
248
|
: { target: target, transitionEnd: transitionEnd };
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
export { BoundingBoxDimension, unitConversion };
|
|
251
|
+
export { BoundingBoxDimension, positionalValues, unitConversion };
|
|
@@ -26,17 +26,11 @@ var svgMotionConfig = {
|
|
|
26
26
|
height: 0,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
if (isPath(instance)) {
|
|
30
|
-
renderState.totalPathLength = instance.getTotalLength();
|
|
31
|
-
}
|
|
32
29
|
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
33
30
|
// TODO: Replace with direct assignment
|
|
34
31
|
renderSVG(instance, renderState);
|
|
35
32
|
},
|
|
36
33
|
}),
|
|
37
34
|
};
|
|
38
|
-
function isPath(element) {
|
|
39
|
-
return element.tagName === "path";
|
|
40
|
-
}
|
|
41
35
|
|
|
42
36
|
export { svgMotionConfig };
|
|
@@ -13,7 +13,7 @@ function buildSVGAttrs(state, _a, options, transformTemplate) {
|
|
|
13
13
|
buildHTMLStyles(state, latest, options, transformTemplate);
|
|
14
14
|
state.attrs = state.style;
|
|
15
15
|
state.style = {};
|
|
16
|
-
var attrs = state.attrs, style = state.style, dimensions = state.dimensions
|
|
16
|
+
var attrs = state.attrs, style = state.style, dimensions = state.dimensions;
|
|
17
17
|
/**
|
|
18
18
|
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
|
|
19
19
|
* and copy it into style.
|
|
@@ -33,9 +33,9 @@ function buildSVGAttrs(state, _a, options, transformTemplate) {
|
|
|
33
33
|
attrs.x = attrX;
|
|
34
34
|
if (attrY !== undefined)
|
|
35
35
|
attrs.y = attrY;
|
|
36
|
-
// Build SVG path if one has been
|
|
37
|
-
if (
|
|
38
|
-
buildSVGPath(attrs,
|
|
36
|
+
// Build SVG path if one has been defined
|
|
37
|
+
if (pathLength !== undefined) {
|
|
38
|
+
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { px } from 'style-value-types';
|
|
2
2
|
|
|
3
|
-
// Convert a progress 0-1 to a pixels value based on the provided length
|
|
4
|
-
var progressToPixels = function (progress, length) {
|
|
5
|
-
return px.transform(progress * length);
|
|
6
|
-
};
|
|
7
3
|
var dashKeys = {
|
|
8
4
|
offset: "stroke-dashoffset",
|
|
9
5
|
array: "stroke-dasharray",
|
|
@@ -19,18 +15,20 @@ var camelKeys = {
|
|
|
19
15
|
*
|
|
20
16
|
* This function is mutative to reduce per-frame GC.
|
|
21
17
|
*/
|
|
22
|
-
function buildSVGPath(attrs,
|
|
18
|
+
function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
|
|
23
19
|
if (spacing === void 0) { spacing = 1; }
|
|
24
20
|
if (offset === void 0) { offset = 0; }
|
|
25
21
|
if (useDashCase === void 0) { useDashCase = true; }
|
|
22
|
+
// Normalise path length by setting SVG attribute pathLength to 1
|
|
23
|
+
attrs.pathLength = 1;
|
|
26
24
|
// We use dash case when setting attributes directly to the DOM node and camel case
|
|
27
25
|
// when defining props on a React component.
|
|
28
26
|
var keys = useDashCase ? dashKeys : camelKeys;
|
|
29
27
|
// Build the dash offset
|
|
30
|
-
attrs[keys.offset] =
|
|
28
|
+
attrs[keys.offset] = px.transform(-offset);
|
|
31
29
|
// Build the dash array
|
|
32
|
-
var pathLength =
|
|
33
|
-
var pathSpacing =
|
|
30
|
+
var pathLength = px.transform(length);
|
|
31
|
+
var pathSpacing = px.transform(spacing);
|
|
34
32
|
attrs[keys.array] = pathLength + " " + pathSpacing;
|
|
35
33
|
}
|
|
36
34
|
|
|
@@ -8,10 +8,10 @@ import { isVariantLabels, resolveVariant, isVariantLabel } from './variants.mjs'
|
|
|
8
8
|
|
|
9
9
|
var variantPriorityOrder = [
|
|
10
10
|
AnimationType.Animate,
|
|
11
|
+
AnimationType.Focus,
|
|
11
12
|
AnimationType.Hover,
|
|
12
13
|
AnimationType.Tap,
|
|
13
14
|
AnimationType.Drag,
|
|
14
|
-
AnimationType.Focus,
|
|
15
15
|
AnimationType.Exit,
|
|
16
16
|
];
|
|
17
17
|
var reversePriorityOrder = __spreadArray([], __read(variantPriorityOrder), false).reverse();
|
|
@@ -30,12 +30,28 @@ function resolveVariantFromProps(props, definition, custom, currentValues, curre
|
|
|
30
30
|
var _a;
|
|
31
31
|
if (currentValues === void 0) { currentValues = {}; }
|
|
32
32
|
if (currentVelocity === void 0) { currentVelocity = {}; }
|
|
33
|
+
/**
|
|
34
|
+
* If the variant definition is a function, resolve.
|
|
35
|
+
*/
|
|
36
|
+
if (typeof definition === "function") {
|
|
37
|
+
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* If the variant definition is a variant label, or
|
|
41
|
+
* the function returned a variant label, resolve.
|
|
42
|
+
*/
|
|
33
43
|
if (typeof definition === "string") {
|
|
34
44
|
definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
/**
|
|
47
|
+
* At this point we've resolved both functions and variant labels,
|
|
48
|
+
* but the resolved variant label might itself have been a function.
|
|
49
|
+
* If so, resolve. This can only have returned a valid target object.
|
|
50
|
+
*/
|
|
51
|
+
if (typeof definition === "function") {
|
|
52
|
+
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
|
|
53
|
+
}
|
|
54
|
+
return definition;
|
|
39
55
|
}
|
|
40
56
|
function resolveVariant(visualElement, definition, custom) {
|
|
41
57
|
var props = visualElement.getProps();
|
|
@@ -230,12 +230,28 @@ function resolveVariantFromProps(props, definition, custom, currentValues, curre
|
|
|
230
230
|
var _a;
|
|
231
231
|
if (currentValues === void 0) { currentValues = {}; }
|
|
232
232
|
if (currentVelocity === void 0) { currentVelocity = {}; }
|
|
233
|
+
/**
|
|
234
|
+
* If the variant definition is a function, resolve.
|
|
235
|
+
*/
|
|
236
|
+
if (typeof definition === "function") {
|
|
237
|
+
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* If the variant definition is a variant label, or
|
|
241
|
+
* the function returned a variant label, resolve.
|
|
242
|
+
*/
|
|
233
243
|
if (typeof definition === "string") {
|
|
234
244
|
definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
|
|
235
245
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
/**
|
|
247
|
+
* At this point we've resolved both functions and variant labels,
|
|
248
|
+
* but the resolved variant label might itself have been a function.
|
|
249
|
+
* If so, resolve. This can only have returned a valid target object.
|
|
250
|
+
*/
|
|
251
|
+
if (typeof definition === "function") {
|
|
252
|
+
definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
|
|
253
|
+
}
|
|
254
|
+
return definition;
|
|
239
255
|
}
|
|
240
256
|
function resolveVariant(visualElement, definition, custom) {
|
|
241
257
|
var props = visualElement.getProps();
|
|
@@ -3332,6 +3348,7 @@ var validMotionProps = new Set([
|
|
|
3332
3348
|
"dragListener",
|
|
3333
3349
|
"dragConstraints",
|
|
3334
3350
|
"dragDirectionLock",
|
|
3351
|
+
"dragSnapToOrigin",
|
|
3335
3352
|
"_dragX",
|
|
3336
3353
|
"_dragY",
|
|
3337
3354
|
"dragElastic",
|
|
@@ -3421,10 +3438,6 @@ function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
|
3421
3438
|
return pxOriginX + " " + pxOriginY;
|
|
3422
3439
|
}
|
|
3423
3440
|
|
|
3424
|
-
// Convert a progress 0-1 to a pixels value based on the provided length
|
|
3425
|
-
var progressToPixels = function (progress, length) {
|
|
3426
|
-
return styleValueTypes.px.transform(progress * length);
|
|
3427
|
-
};
|
|
3428
3441
|
var dashKeys = {
|
|
3429
3442
|
offset: "stroke-dashoffset",
|
|
3430
3443
|
array: "stroke-dasharray",
|
|
@@ -3440,18 +3453,20 @@ var camelKeys = {
|
|
|
3440
3453
|
*
|
|
3441
3454
|
* This function is mutative to reduce per-frame GC.
|
|
3442
3455
|
*/
|
|
3443
|
-
function buildSVGPath(attrs,
|
|
3456
|
+
function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
|
|
3444
3457
|
if (spacing === void 0) { spacing = 1; }
|
|
3445
3458
|
if (offset === void 0) { offset = 0; }
|
|
3446
3459
|
if (useDashCase === void 0) { useDashCase = true; }
|
|
3460
|
+
// Normalise path length by setting SVG attribute pathLength to 1
|
|
3461
|
+
attrs.pathLength = 1;
|
|
3447
3462
|
// We use dash case when setting attributes directly to the DOM node and camel case
|
|
3448
3463
|
// when defining props on a React component.
|
|
3449
3464
|
var keys = useDashCase ? dashKeys : camelKeys;
|
|
3450
3465
|
// Build the dash offset
|
|
3451
|
-
attrs[keys.offset] =
|
|
3466
|
+
attrs[keys.offset] = styleValueTypes.px.transform(-offset);
|
|
3452
3467
|
// Build the dash array
|
|
3453
|
-
var pathLength =
|
|
3454
|
-
var pathSpacing =
|
|
3468
|
+
var pathLength = styleValueTypes.px.transform(length);
|
|
3469
|
+
var pathSpacing = styleValueTypes.px.transform(spacing);
|
|
3455
3470
|
attrs[keys.array] = pathLength + " " + pathSpacing;
|
|
3456
3471
|
}
|
|
3457
3472
|
|
|
@@ -3465,7 +3480,7 @@ function buildSVGAttrs(state, _a, options, transformTemplate) {
|
|
|
3465
3480
|
buildHTMLStyles(state, latest, options, transformTemplate);
|
|
3466
3481
|
state.attrs = state.style;
|
|
3467
3482
|
state.style = {};
|
|
3468
|
-
var attrs = state.attrs, style = state.style, dimensions = state.dimensions
|
|
3483
|
+
var attrs = state.attrs, style = state.style, dimensions = state.dimensions;
|
|
3469
3484
|
/**
|
|
3470
3485
|
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
|
|
3471
3486
|
* and copy it into style.
|
|
@@ -3485,9 +3500,9 @@ function buildSVGAttrs(state, _a, options, transformTemplate) {
|
|
|
3485
3500
|
attrs.x = attrX;
|
|
3486
3501
|
if (attrY !== undefined)
|
|
3487
3502
|
attrs.y = attrY;
|
|
3488
|
-
// Build SVG path if one has been
|
|
3489
|
-
if (
|
|
3490
|
-
buildSVGPath(attrs,
|
|
3503
|
+
// Build SVG path if one has been defined
|
|
3504
|
+
if (pathLength !== undefined) {
|
|
3505
|
+
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
|
|
3491
3506
|
}
|
|
3492
3507
|
}
|
|
3493
3508
|
|
|
@@ -3566,6 +3581,7 @@ var camelCaseAttributes = new Set([
|
|
|
3566
3581
|
"tableValues",
|
|
3567
3582
|
"viewBox",
|
|
3568
3583
|
"gradientTransform",
|
|
3584
|
+
"pathLength",
|
|
3569
3585
|
]);
|
|
3570
3586
|
|
|
3571
3587
|
function renderSVG(element, renderState) {
|
|
@@ -3677,18 +3693,12 @@ var svgMotionConfig = {
|
|
|
3677
3693
|
height: 0,
|
|
3678
3694
|
};
|
|
3679
3695
|
}
|
|
3680
|
-
if (isPath(instance)) {
|
|
3681
|
-
renderState.totalPathLength = instance.getTotalLength();
|
|
3682
|
-
}
|
|
3683
3696
|
buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
|
|
3684
3697
|
// TODO: Replace with direct assignment
|
|
3685
3698
|
renderSVG(instance, renderState);
|
|
3686
3699
|
},
|
|
3687
3700
|
}),
|
|
3688
3701
|
};
|
|
3689
|
-
function isPath(element) {
|
|
3690
|
-
return element.tagName === "path";
|
|
3691
|
-
}
|
|
3692
3702
|
|
|
3693
3703
|
var htmlMotionConfig = {
|
|
3694
3704
|
useVisualState: makeUseVisualState({
|
|
@@ -4397,10 +4407,10 @@ function shouldBlockAnimation(_a, key) {
|
|
|
4397
4407
|
|
|
4398
4408
|
var variantPriorityOrder = [
|
|
4399
4409
|
AnimationType.Animate,
|
|
4410
|
+
AnimationType.Focus,
|
|
4400
4411
|
AnimationType.Hover,
|
|
4401
4412
|
AnimationType.Tap,
|
|
4402
4413
|
AnimationType.Drag,
|
|
4403
|
-
AnimationType.Focus,
|
|
4404
4414
|
AnimationType.Exit,
|
|
4405
4415
|
];
|
|
4406
4416
|
var reversePriorityOrder = tslib.__spreadArray([], tslib.__read(variantPriorityOrder), false).reverse();
|
|
@@ -5129,7 +5139,19 @@ var VisualElementDragControls = /** @class */ (function () {
|
|
|
5129
5139
|
* Record gesture origin
|
|
5130
5140
|
*/
|
|
5131
5141
|
eachAxis(function (axis) {
|
|
5132
|
-
|
|
5142
|
+
var _a, _b;
|
|
5143
|
+
var current = _this.getAxisMotionValue(axis).get() || 0;
|
|
5144
|
+
/**
|
|
5145
|
+
* If the MotionValue is a percentage value convert to px
|
|
5146
|
+
*/
|
|
5147
|
+
if (styleValueTypes.percent.test(current)) {
|
|
5148
|
+
var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
|
|
5149
|
+
if (measuredAxis) {
|
|
5150
|
+
var length_1 = calcLength(measuredAxis);
|
|
5151
|
+
current = length_1 * (parseFloat(current) / 100);
|
|
5152
|
+
}
|
|
5153
|
+
}
|
|
5154
|
+
_this.originPoint[axis] = current;
|
|
5133
5155
|
});
|
|
5134
5156
|
// Fire onDragStart event
|
|
5135
5157
|
onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, info);
|
|
@@ -6173,13 +6195,15 @@ function removeNonTranslationalTransform(visualElement) {
|
|
|
6173
6195
|
}
|
|
6174
6196
|
var positionalValues = {
|
|
6175
6197
|
// Dimensions
|
|
6176
|
-
width: function (_a) {
|
|
6198
|
+
width: function (_a, _b) {
|
|
6177
6199
|
var x = _a.x;
|
|
6178
|
-
|
|
6200
|
+
var _c = _b.paddingLeft, paddingLeft = _c === void 0 ? "0" : _c, _d = _b.paddingRight, paddingRight = _d === void 0 ? "0" : _d;
|
|
6201
|
+
return x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight);
|
|
6179
6202
|
},
|
|
6180
|
-
height: function (_a) {
|
|
6203
|
+
height: function (_a, _b) {
|
|
6181
6204
|
var y = _a.y;
|
|
6182
|
-
|
|
6205
|
+
var _c = _b.paddingTop, paddingTop = _c === void 0 ? "0" : _c, _d = _b.paddingBottom, paddingBottom = _d === void 0 ? "0" : _d;
|
|
6206
|
+
return y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom);
|
|
6183
6207
|
},
|
|
6184
6208
|
top: function (_bbox, _a) {
|
|
6185
6209
|
var top = _a.top;
|
|
@@ -6207,8 +6231,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
|
|
|
6207
6231
|
var originBbox = visualElement.measureViewportBox();
|
|
6208
6232
|
var element = visualElement.getInstance();
|
|
6209
6233
|
var elementComputedStyle = getComputedStyle(element);
|
|
6210
|
-
var display = elementComputedStyle.display
|
|
6211
|
-
var originComputedStyle = { top: top, left: left, bottom: bottom, right: right, transform: transform };
|
|
6234
|
+
var display = elementComputedStyle.display;
|
|
6212
6235
|
// If the element is currently set to display: "none", make it visible before
|
|
6213
6236
|
// measuring the target bounding box
|
|
6214
6237
|
if (display === "none") {
|
|
@@ -6221,7 +6244,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
|
|
|
6221
6244
|
// Restore styles to their **calculated computed style**, not their actual
|
|
6222
6245
|
// originally set style. This allows us to animate between equivalent pixel units.
|
|
6223
6246
|
var value = visualElement.getValue(key);
|
|
6224
|
-
setAndResetVelocity(value, positionalValues[key](originBbox,
|
|
6247
|
+
setAndResetVelocity(value, positionalValues[key](originBbox, elementComputedStyle));
|
|
6225
6248
|
target[key] = positionalValues[key](targetBbox, elementComputedStyle);
|
|
6226
6249
|
});
|
|
6227
6250
|
return target;
|