* 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)
| 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. |
no test coverage detected