mixin-get-global-position.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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. 'use strict';
  9. var display = require('@pixi/display');
  10. var math = require('@pixi/math');
  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. //# sourceMappingURL=mixin-get-global-position.js.map