MCPcopy Create free account
hub / github.com/melonjs/melonJS / moveTo

Method moveTo

packages/melonjs/src/camera/camera2d.ts:590–601  ·  view source on GitHub ↗

* move the camera upper-left position to the specified coordinates * @see focusOn * @param x - horizontal position * @param y - vertical position

(x: number, y: number)

Source from the content-addressed store, hash-verified

588 * @param y - vertical position
589 */
590 moveTo(x: number, y: number): void {
591 const _x = this.pos.x;
592 const _y = this.pos.y;
593
594 this.pos.x = clamp(x, this.bounds.left, this.bounds.width - this.width);
595 this.pos.y = clamp(y, this.bounds.top, this.bounds.height - this.height);
596
597 //publish the VIEWPORT_ONCHANGE event if necessary
598 if (_x !== this.pos.x || _y !== this.pos.y) {
599 this.isDirty = true;
600 }
601 }
602
603 /** @ignore */
604

Callers 15

setBoundsMethod · 0.95
moveMethod · 0.95
focusOnMethod · 0.95
drawTriangleMethod · 0.45
drawMethod · 0.45
toCanvasMethod · 0.45
roundRectFunction · 0.45
bezier.spec.jsFile · 0.45
camera.spec.jsFile · 0.45
path2d.spec.jsFile · 0.45
linedash.spec.jsFile · 0.45

Calls 1

clampFunction · 0.90

Tested by

no test coverage detected