mixin-get-global-position.mjs 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. /*!
  2. * @pixi/mixin-get-global-position - v6.5.10
  3. * Compiled Thu, 06 Jul 2023 15:25:11 UTC
  4. *
  5. * @pixi/mixin-get-global-position is licensed under the MIT License.
  6. * http://www.opensource.org/licenses/mit-license
  7. */
  8. import { DisplayObject } from '@pixi/display';
  9. import { Point } from '@pixi/math';
  10. /**
  11. * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.
  12. * @method getGlobalPosition
  13. * @memberof PIXI.DisplayObject#
  14. * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.
  15. * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from
  16. * being updated. This means the calculation returned MAY be out of date BUT will give you a
  17. * nice performance boost.
  18. * @returns {PIXI.Point} The updated point.
  19. */
  20. DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) {
  21. if (point === void 0) { point = new Point(); }
  22. if (skipUpdate === void 0) { skipUpdate = false; }
  23. if (this.parent) {
  24. this.parent.toGlobal(this.position, point, skipUpdate);
  25. }
  26. else {
  27. point.x = this.position.x;
  28. point.y = this.position.y;
  29. }
  30. return point;
  31. };
  32. //# sourceMappingURL=mixin-get-global-position.mjs.map