framer-motion 5.2.0 → 5.2.1

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.
@@ -307,7 +307,7 @@ function createProjectionNode(_a) {
307
307
  node.updateScroll();
308
308
  }
309
309
  var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;
310
- if (!layoutId && !layout)
310
+ if (layoutId === undefined && !layout)
311
311
  return;
312
312
  var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;
313
313
  this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
@@ -115,11 +115,18 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
115
115
  var element = visualElement.getInstance();
116
116
  var elementComputedStyle = getComputedStyle(element);
117
117
  var display = elementComputedStyle.display;
118
+ var origin = {};
118
119
  // If the element is currently set to display: "none", make it visible before
119
120
  // measuring the target bounding box
120
121
  if (display === "none") {
121
122
  visualElement.setStaticValue("display", target.display || "block");
122
123
  }
124
+ /**
125
+ * Record origins before we render and update styles
126
+ */
127
+ changedKeys.forEach(function (key) {
128
+ origin[key] = positionalValues[key](originBbox, elementComputedStyle);
129
+ });
123
130
  // Apply the latest values (as set in checkAndConvertChangedValueTypes)
124
131
  visualElement.syncRender();
125
132
  var targetBbox = visualElement.measureViewportBox();
@@ -127,7 +134,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
127
134
  // Restore styles to their **calculated computed style**, not their actual
128
135
  // originally set style. This allows us to animate between equivalent pixel units.
129
136
  var value = visualElement.getValue(key);
130
- setAndResetVelocity(value, positionalValues[key](originBbox, elementComputedStyle));
137
+ setAndResetVelocity(value, origin[key]);
131
138
  target[key] = positionalValues[key](targetBbox, elementComputedStyle);
132
139
  });
133
140
  return target;
@@ -1988,7 +1988,7 @@ function createProjectionNode(_a) {
1988
1988
  node.updateScroll();
1989
1989
  }
1990
1990
  var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;
1991
- if (!layoutId && !layout)
1991
+ if (layoutId === undefined && !layout)
1992
1992
  return;
1993
1993
  var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;
1994
1994
  this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
@@ -6232,11 +6232,18 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
6232
6232
  var element = visualElement.getInstance();
6233
6233
  var elementComputedStyle = getComputedStyle(element);
6234
6234
  var display = elementComputedStyle.display;
6235
+ var origin = {};
6235
6236
  // If the element is currently set to display: "none", make it visible before
6236
6237
  // measuring the target bounding box
6237
6238
  if (display === "none") {
6238
6239
  visualElement.setStaticValue("display", target.display || "block");
6239
6240
  }
6241
+ /**
6242
+ * Record origins before we render and update styles
6243
+ */
6244
+ changedKeys.forEach(function (key) {
6245
+ origin[key] = positionalValues[key](originBbox, elementComputedStyle);
6246
+ });
6240
6247
  // Apply the latest values (as set in checkAndConvertChangedValueTypes)
6241
6248
  visualElement.syncRender();
6242
6249
  var targetBbox = visualElement.measureViewportBox();
@@ -6244,7 +6251,7 @@ var convertChangedValueTypes = function (target, visualElement, changedKeys) {
6244
6251
  // Restore styles to their **calculated computed style**, not their actual
6245
6252
  // originally set style. This allows us to animate between equivalent pixel units.
6246
6253
  var value = visualElement.getValue(key);
6247
- setAndResetVelocity(value, positionalValues[key](originBbox, elementComputedStyle));
6254
+ setAndResetVelocity(value, origin[key]);
6248
6255
  target[key] = positionalValues[key](targetBbox, elementComputedStyle);
6249
6256
  });
6250
6257
  return target;
@@ -3219,7 +3219,7 @@
3219
3219
  node.updateScroll();
3220
3220
  }
3221
3221
  var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;
3222
- if (!layoutId && !layout)
3222
+ if (layoutId === undefined && !layout)
3223
3223
  return;
3224
3224
  var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;
3225
3225
  this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
@@ -7463,11 +7463,18 @@
7463
7463
  var element = visualElement.getInstance();
7464
7464
  var elementComputedStyle = getComputedStyle(element);
7465
7465
  var display = elementComputedStyle.display;
7466
+ var origin = {};
7466
7467
  // If the element is currently set to display: "none", make it visible before
7467
7468
  // measuring the target bounding box
7468
7469
  if (display === "none") {
7469
7470
  visualElement.setStaticValue("display", target.display || "block");
7470
7471
  }
7472
+ /**
7473
+ * Record origins before we render and update styles
7474
+ */
7475
+ changedKeys.forEach(function (key) {
7476
+ origin[key] = positionalValues[key](originBbox, elementComputedStyle);
7477
+ });
7471
7478
  // Apply the latest values (as set in checkAndConvertChangedValueTypes)
7472
7479
  visualElement.syncRender();
7473
7480
  var targetBbox = visualElement.measureViewportBox();
@@ -7475,7 +7482,7 @@
7475
7482
  // Restore styles to their **calculated computed style**, not their actual
7476
7483
  // originally set style. This allows us to animate between equivalent pixel units.
7477
7484
  var value = visualElement.getValue(key);
7478
- setAndResetVelocity(value, positionalValues[key](originBbox, elementComputedStyle));
7485
+ setAndResetVelocity(value, origin[key]);
7479
7486
  target[key] = positionalValues[key](targetBbox, elementComputedStyle);
7480
7487
  });
7481
7488
  return target;