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

Method shift

packages/melonjs/src/physics/bounds.ts:448–467  ·  view source on GitHub ↗
(xOrVector: number | Vector2d, y?: number)

Source from the content-addressed store, hash-verified

446 shift(x: number, y: number): void;
447 shift(vector: Vector2d): void;
448 shift(xOrVector: number | Vector2d, y?: number) {
449 let _x: number;
450 let _y: number;
451
452 if (xOrVector instanceof Vector2d) {
453 _x = xOrVector.x;
454 _y = xOrVector.y;
455 } else {
456 _x = xOrVector;
457 _y = y!;
458 }
459
460 const deltaX = this.max.x - this.min.x;
461 const deltaY = this.max.y - this.min.y;
462
463 this.min.x = _x;
464 this.max.x = _x + deltaX;
465 this.min.y = _y;
466 this.max.y = _y + deltaY;
467 }
468
469 /**
470 * Creates a clone of this bounds.

Callers 11

centerOnMethod · 0.95
getUriFragmentFunction · 0.45
addPointMethod · 0.45
polygon.spec.jsFile · 0.45
quadtree.spec.jsFile · 0.45
logOpFunction · 0.45
renderable.spec.jsFile · 0.45
rectangle.spec.tsFile · 0.45
bounds.spec.tsFile · 0.45
onResetEventMethod · 0.45
onResetEventMethod · 0.45

Calls

no outgoing calls

Tested by 1

logOpFunction · 0.36