mixin-get-global-position.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  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. this.PIXI = this.PIXI || {};
  9. (function (display, math) {
  10. 'use strict';
  11. /**
  12. * Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.
  13. * @method getGlobalPosition
  14. * @memberof PIXI.DisplayObject#
  15. * @param {PIXI.Point} [point=new PIXI.Point()] - The point to write the global value to.
  16. * @param {boolean} [skipUpdate=false] - Setting to true will stop the transforms of the scene graph from
  17. * being updated. This means the calculation returned MAY be out of date BUT will give you a
  18. * nice performance boost.
  19. * @returns {PIXI.Point} The updated point.
  20. */
  21. display.DisplayObject.prototype.getGlobalPosition = function getGlobalPosition(point, skipUpdate) {
  22. if (point === void 0) { point = new math.Point(); }
  23. if (skipUpdate === void 0) { skipUpdate = false; }
  24. if (this.parent) {
  25. this.parent.toGlobal(this.position, point, skipUpdate);
  26. }
  27. else {
  28. point.x = this.position.x;
  29. point.y = this.position.y;
  30. }
  31. return point;
  32. };
  33. })(PIXI, PIXI);
  34. //# sourceMappingURL=mixin-get-global-position.js.map