feat: add dragMode option to ResizerOptions interface for flexible resizing behavior

This commit is contained in:
Luís Landeiro Ribeiro
2025-04-15 13:59:30 +01:00
parent b4b47f4d55
commit 15091f7fad
5 changed files with 18 additions and 5 deletions

13
dist/grapes.mjs vendored
View File

@@ -53696,6 +53696,11 @@ var Resizer = /** @class */ (function () {
var parentEl = this.getParentEl();
var resizer = this;
var config = this.opts || {};
if ("editor" in window) {
// @ts-ignore
config.dragMode = window.editor.getModel().getDragMode();
}
;
var mouseFetch = this.mousePosFetcher;
var attrName = 'data-' + config.prefix + 'handler';
var rect = this.getElementPos(el, { avoidFrameZoom: true, avoidFrameOffset: true });
@@ -53891,11 +53896,15 @@ var Resizer = /** @class */ (function () {
var startW = unitWidth === '%' ? (startDim.w / 100) * parentW : startDim.w;
var startH = unitHeight === '%' ? (startDim.h / 100) * parentH : startDim.h;
var box = {
t: startDim.t - parentRect.top,
l: startDim.l - parentRect.left,
t: startDim.t,
l: startDim.l,
w: startW,
h: startH,
};
if (!(this.opts.dragMode === 'absolute')) {
box.l += parentRect.left;
box.t += parentRect.top;
}
if (!data)
return;
var attr = data.handlerAttr;