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

Method $moveTo

packages/element-image/src/index.ts:511–521  ·  view source on GitHub ↗

* Moves the image to a specific position. * @param {number} x The new position in the horizontal direction. * @param {number} [y] The new position in the vertical direction. * @returns {CropperImage} Returns `this` for chaining.

(x: number, y: number = x)

Source from the content-addressed store, hash-verified

509 * @returns {CropperImage} Returns `this` for chaining.
510 */
511 $moveTo(x: number, y: number = x): this {
512 if (this.translatable && isNumber(x) && isNumber(y)) {
513 const [a, b, c, d] = this.$matrix;
514 const e = ((x * d) - (c * y)) / ((a * d) - (c * b));
515 const f = ((y * a) - (b * x)) / ((a * d) - (c * b));
516
517 this.$setTransform(a, b, c, d, e, f);
518 }
519
520 return this;
521 }
522
523 /**
524 * Rotates the image.

Callers 1

index.spec.tsFile · 0.45

Calls 2

$setTransformMethod · 0.95
isNumberFunction · 0.90

Tested by

no test coverage detected