feat: add dragMode option to ResizerOptions interface for flexible resizing behavior
This commit is contained in:
2
dist/grapes.min.js
vendored
2
dist/grapes.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/grapes.min.js.map
vendored
2
dist/grapes.min.js.map
vendored
File diff suppressed because one or more lines are too long
13
dist/grapes.mjs
vendored
13
dist/grapes.mjs
vendored
@@ -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;
|
||||
|
2
dist/grapes.mjs.map
vendored
2
dist/grapes.mjs.map
vendored
File diff suppressed because one or more lines are too long
4
dist/index.d.ts
vendored
4
dist/index.d.ts
vendored
@@ -4060,6 +4060,10 @@ export interface ResizerOptions {
|
||||
* Where to append resize container (default body element).
|
||||
*/
|
||||
appendTo?: HTMLElement;
|
||||
/**
|
||||
* Drag mode
|
||||
*/
|
||||
dragMode?: "absolute" | "relative";
|
||||
}
|
||||
export type Handlers = Record<string, HTMLElement | null>;
|
||||
declare class Resizer {
|
||||
|
Reference in New Issue
Block a user