MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / DDResizable

Class DDResizable

src/dd-resizable.ts:41–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41export class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {
42 /** @internal */
43 protected handlers: DDResizableHandle[];
44 /** @internal */
45 protected originalRect: DOMRectReadOnly;
46 /** @internal */
47 protected rectScale: RectScaleReciprocal = { x: 1, y: 1 };
48 /** @internal */
49 protected temporalRect: TemporalRect;
50 /** @internal */
51 protected scrollY: number;
52 /** @internal */
53 protected scrolled: number;
54 /** @internal */
55 protected scrollEl: HTMLElement;
56 /** @internal */
57 protected startEvent: MouseEvent;
58 /** @internal value saved in the same order as _originStyleProp[] */
59 protected elOriginStyleVal: string[];
60 /** @internal */
61 protected parentOriginStylePosition: string;
62 /** @internal */
63 protected static _originStyleProp = ['width', 'height', 'position', 'left', 'right', 'top', 'opacity', 'zIndex'];
64 /** @internal */
65 protected sizeToContent: boolean;
66
67 // have to be public else complains for HTMLElementExtendOpt ?
68 constructor(public el: GridItemHTMLElement, public option: DDResizableOpt = {}) {
69 super();
70 // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)
71 this._mouseOver = this._mouseOver.bind(this);
72 this._mouseOut = this._mouseOut.bind(this);
73 this.enable();
74 this._setupAutoHide(this.option.autoHide);
75 this._setupHandlers();
76 }
77
78 public on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void {
79 super.on(event, callback);
80 }
81
82 public off(event: 'resizestart' | 'resize' | 'resizestop'): void {
83 super.off(event);
84 }
85
86 public enable(): void {
87 super.enable();
88 this.el.classList.remove('ui-resizable-disabled');
89 this._setupAutoHide(this.option.autoHide);
90 }
91
92 public disable(): void {
93 super.disable();
94 this.el.classList.add('ui-resizable-disabled');
95 this._setupAutoHide(false);
96 }
97
98 public destroy(): void {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected