MCPcopy
hub / github.com/fengyuanchen/cropperjs / $change

Method $change

packages/element-shade/src/index.ts:151–172  ·  view source on GitHub ↗

* Changes the position and/or size of the shade. * @param {number} x The new position in the horizontal direction. * @param {number} y The new position in the vertical direction. * @param {number} [width] The new width. * @param {number} [height] The new height. * @returns {CropperSha

(x: number, y: number, width: number = this.width, height: number = this.height)

Source from the content-addressed store, hash-verified

149 * @returns {CropperShade} Returns `this` for chaining.
150 */
151 $change(x: number, y: number, width: number = this.width, height: number = this.height): this {
152 if (
153 !isNumber(x)
154 || !isNumber(y)
155 || !isNumber(width)
156 || !isNumber(height)
157 || (x === this.x && y === this.y && width === this.width && height === this.height)
158 ) {
159 return this;
160 }
161
162 if (this.hidden) {
163 this.hidden = false;
164 }
165
166 this.x = x;
167 this.y = y;
168 this.width = width;
169 this.height = height;
170
171 return this.$render();
172 }
173
174 /**
175 * Resets the shade to its initial position and size.

Callers 2

connectedCallbackMethod · 0.95
$resetMethod · 0.95

Calls 2

$renderMethod · 0.95
isNumberFunction · 0.90

Tested by

no test coverage detected