2 Commits

Author SHA1 Message Date
Luis Landeiro Ribeiro
6c9fa44fa4 new release fix resize in absolute mode with transforms applied 2026-03-02 22:36:43 +00:00
Luis Landeiro Ribeiro
e727435fb1 bump to version 0.22.15 2026-03-01 23:07:26 +00:00
4 changed files with 29 additions and 7 deletions

4
dist/grapes.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
dist/grapes.mjs vendored
View File

@@ -17718,6 +17718,12 @@ var ConvertUnitsToPx;
var resizeEventOpts = { component: component, el: el };
var modelToStyle;
var elComputedStyle;
// Captured at resize-start; used in updateTarget to compute position deltas
// that are immune to any CSS transform applied on the element.
var startCSSTop = 0;
var startCSSLeft = 0;
var startVisualRelTop = 0;
var startVisualRelLeft = 0;
var toggleBodyClass = function (method, e, opts) {
var docs = opts.docs;
docs &&
@@ -17737,6 +17743,15 @@ var ConvertUnitsToPx;
elComputedStyle = getComputedStyle(el);
var modelStyle = modelToStyle.getStyle();
var rectStart = __assign({}, resizer.startDim);
// Save original CSS top/left (in px, from computedStyle which excludes transforms)
// and the element's starting visual position relative to its offset-parent.
// These are used in updateTarget to apply a pure delta so that a CSS transform on
// the element does not pollute the top/left style values.
startCSSTop = parseFloat(elComputedStyle['top']) || 0;
startCSSLeft = parseFloat(elComputedStyle['left']) || 0;
var parentRectAtStart = resizer.getParentRect();
startVisualRelTop = resizer.startDim.t - parentRectAtStart.top;
startVisualRelLeft = resizer.startDim.l - parentRectAtStart.left;
var currentWidth = modelStyle[keyWidth];
config.autoWidth = keepAutoWidth && currentWidth === 'auto';
if (isNaN(parseFloat(currentWidth))) {
@@ -17823,8 +17838,15 @@ var ConvertUnitsToPx;
});
}
if (!skipPositionUpdate && em.getDragMode(component)) {
style.top = "".concat(rect.t, "px");
style.left = "".concat(rect.l, "px");
// rect.t / rect.l are visual positions from getBoundingClientRect, which
// include any CSS transform on the element. We must not assign them directly
// to top/left (CSS positional properties are transform-agnostic).
// Instead, compute the visual delta from the start position and add it to
// the original CSS values so the transform offset is never double-counted.
var deltaTop = rect.t - startVisualRelTop;
var deltaLeft = rect.l - startVisualRelLeft;
style.top = "".concat(startCSSTop + deltaTop, "px");
style.left = "".concat(startCSSLeft + deltaLeft, "px");
}
var styleUpdated = false;
var updateStyle = function (customStyle) {
@@ -69471,7 +69493,7 @@ var grapesjs = {
plugins: plugins,
usePlugin: usePlugin,
// @ts-ignore Will be replaced on build
version: '0.22.14',
version: '0.22.16',
/**
* Initialize the editor with passed options
* @param {Object} config Configuration object

2
dist/grapes.mjs.map vendored

File diff suppressed because one or more lines are too long