Socket
Socket
Sign inDemoInstall

@pixi/display

Package Overview
Dependencies
Maintainers
1
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/display - npm Package Compare versions

Comparing version 5.2.4 to 5.3.0

6

dist/display.min.js
/*!
* @pixi/display - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/display - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
*

@@ -8,3 +8,3 @@ * @pixi/display is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_display=function(t,i,e,n){"use strict";i.settings.SORTABLE_CHILDREN=!1;var s=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null};s.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},s.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},s.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?e.Rectangle.EMPTY:((t=t||new e.Rectangle(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},s.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},s.prototype.addQuad=function(t){var i=this.minX,e=this.minY,n=this.maxX,s=this.maxY,r=t[0],h=t[1];i=r<i?r:i,e=h<e?h:e,n=r>n?r:n,s=h>s?h:s,i=(r=t[2])<i?r:i,e=(h=t[3])<e?h:e,n=r>n?r:n,s=h>s?h:s,i=(r=t[4])<i?r:i,e=(h=t[5])<e?h:e,n=r>n?r:n,s=h>s?h:s,i=(r=t[6])<i?r:i,e=(h=t[7])<e?h:e,n=r>n?r:n,s=h>s?h:s,this.minX=i,this.minY=e,this.maxX=n,this.maxY=s},s.prototype.addFrame=function(t,i,e,n,s){this.addFrameMatrix(t.worldTransform,i,e,n,s)},s.prototype.addFrameMatrix=function(t,i,e,n,s){var r=t.a,h=t.b,o=t.c,a=t.d,l=t.tx,d=t.ty,m=this.minX,p=this.minY,u=this.maxX,c=this.maxY,f=r*i+o*e+l,x=h*i+a*e+d;m=f<m?f:m,p=x<p?x:p,u=f>u?f:u,c=x>c?x:c,m=(f=r*n+o*e+l)<m?f:m,p=(x=h*n+a*e+d)<p?x:p,u=f>u?f:u,c=x>c?x:c,m=(f=r*i+o*s+l)<m?f:m,p=(x=h*i+a*s+d)<p?x:p,u=f>u?f:u,c=x>c?x:c,m=(f=r*n+o*s+l)<m?f:m,p=(x=h*n+a*s+d)<p?x:p,u=f>u?f:u,c=x>c?x:c,this.minX=m,this.minY=p,this.maxX=u,this.maxY=c},s.prototype.addVertexData=function(t,i,e){for(var n=this.minX,s=this.minY,r=this.maxX,h=this.maxY,o=i;o<e;o+=2){var a=t[o],l=t[o+1];n=a<n?a:n,s=l<s?l:s,r=a>r?a:r,h=l>h?l:h}this.minX=n,this.minY=s,this.maxX=r,this.maxY=h},s.prototype.addVertices=function(t,i,e,n){this.addVerticesMatrix(t.worldTransform,i,e,n)},s.prototype.addVerticesMatrix=function(t,i,e,n,s,r){var h=t.a,o=t.b,a=t.c,l=t.d,d=t.tx,m=t.ty;s=s||0,r=r||0;for(var p=this.minX,u=this.minY,c=this.maxX,f=this.maxY,x=e;x<n;x+=2){var y=i[x],_=i[x+1],b=h*y+a*_+d,g=l*_+o*y+m;p=Math.min(p,b-s),c=Math.max(c,b+s),u=Math.min(u,g-r),f=Math.max(f,g+r)}this.minX=p,this.minY=u,this.maxX=c,this.maxY=f},s.prototype.addBounds=function(t){var i=this.minX,e=this.minY,n=this.maxX,s=this.maxY;this.minX=t.minX<i?t.minX:i,this.minY=t.minY<e?t.minY:e,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>s?t.maxY:s},s.prototype.addBoundsMask=function(t,i){var e=t.minX>i.minX?t.minX:i.minX,n=t.minY>i.minY?t.minY:i.minY,s=t.maxX<i.maxX?t.maxX:i.maxX,r=t.maxY<i.maxY?t.maxY:i.maxY;if(e<=s&&n<=r){var h=this.minX,o=this.minY,a=this.maxX,l=this.maxY;this.minX=e<h?e:h,this.minY=n<o?n:o,this.maxX=s>a?s:a,this.maxY=r>l?r:l}},s.prototype.addBoundsMatrix=function(t,i){this.addFrameMatrix(i,t.minX,t.minY,t.maxX,t.maxY)},s.prototype.addBoundsArea=function(t,i){var e=t.minX>i.x?t.minX:i.x,n=t.minY>i.y?t.minY:i.y,s=t.maxX<i.x+i.width?t.maxX:i.x+i.width,r=t.maxY<i.y+i.height?t.maxY:i.y+i.height;if(e<=s&&n<=r){var h=this.minX,o=this.minY,a=this.maxX,l=this.maxY;this.minX=e<h?e:h,this.minY=n<o?n:o,this.maxX=s>a?s:a,this.maxY=r>l?r:l}},s.prototype.pad=function(t,i){t=t||0,i=i||(0!==i?t:0),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i)},s.prototype.addFramePad=function(t,i,e,n,s,r){t-=s,i-=r,e+=s,n+=r,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>e?this.maxX:e,this.minY=this.minY<i?this.minY:i,this.maxY=this.maxY>n?this.maxY:n};var r=function(t){function i(){t.call(this),this.tempDisplayObjectParent=null,this.transform=new e.Transform,this.alpha=1,this.visible=!0,this.renderable=!0,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new s,this._boundsID=0,this._lastBoundsID=-1,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i;var n={_tempDisplayObjectParent:{configurable:!0},x:{configurable:!0},y:{configurable:!0},worldTransform:{configurable:!0},localTransform:{configurable:!0},position:{configurable:!0},scale:{configurable:!0},pivot:{configurable:!0},skew:{configurable:!0},rotation:{configurable:!0},angle:{configurable:!0},zIndex:{configurable:!0},worldVisible:{configurable:!0},mask:{configurable:!0}};return i.mixin=function(t){for(var e=Object.keys(t),n=0;n<e.length;++n){var s=e[n];Object.defineProperty(i.prototype,s,Object.getOwnPropertyDescriptor(t,s))}},n._tempDisplayObjectParent.get=function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new i),this.tempDisplayObjectParent},i.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},i.prototype.calculateBounds=function(){},i.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},i.prototype.getBounds=function(t,i){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._boundsID!==this._lastBoundsID&&(this.calculateBounds(),this._lastBoundsID=this._boundsID),i||(this._boundsRect||(this._boundsRect=new e.Rectangle),i=this._boundsRect),this._bounds.getRectangle(i)},i.prototype.getLocalBounds=function(t){var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform,t||(this._localBoundsRect||(this._localBoundsRect=new e.Rectangle),t=this._localBoundsRect);var s=this.getBounds(!1,t);return this.parent=n,this.transform=i,s},i.prototype.toGlobal=function(t,i,e){return void 0===e&&(e=!1),e||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,i)},i.prototype.toLocal=function(t,i,e,n){return i&&(t=i.toGlobal(t,e,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,e)},i.prototype.render=function(t){},i.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},i.prototype.setTransform=function(t,i,e,n,s,r,h,o,a){return void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=1),void 0===n&&(n=1),void 0===s&&(s=0),void 0===r&&(r=0),void 0===h&&(h=0),void 0===o&&(o=0),void 0===a&&(a=0),this.position.x=t,this.position.y=i,this.scale.x=e||1,this.scale.y=n||1,this.rotation=s,this.skew.x=r,this.skew.y=h,this.pivot.x=o,this.pivot.y=a,this},i.prototype.destroy=function(){this.parent&&this.parent.removeChild(this),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._currentBounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},n.x.get=function(){return this.position.x},n.x.set=function(t){this.transform.position.x=t},n.y.get=function(){return this.position.y},n.y.set=function(t){this.transform.position.y=t},n.worldTransform.get=function(){return this.transform.worldTransform},n.localTransform.get=function(){return this.transform.localTransform},n.position.get=function(){return this.transform.position},n.position.set=function(t){this.transform.position.copyFrom(t)},n.scale.get=function(){return this.transform.scale},n.scale.set=function(t){this.transform.scale.copyFrom(t)},n.pivot.get=function(){return this.transform.pivot},n.pivot.set=function(t){this.transform.pivot.copyFrom(t)},n.skew.get=function(){return this.transform.skew},n.skew.set=function(t){this.transform.skew.copyFrom(t)},n.rotation.get=function(){return this.transform.rotation},n.rotation.set=function(t){this.transform.rotation=t},n.angle.get=function(){return this.transform.rotation*e.RAD_TO_DEG},n.angle.set=function(t){this.transform.rotation=t*e.DEG_TO_RAD},n.zIndex.get=function(){return this._zIndex},n.zIndex.set=function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},n.worldVisible.get=function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},n.mask.get=function(){return this._mask},n.mask.set=function(t){if(this._mask){var i=this._mask.maskObject||this._mask;i.renderable=!0,i.isMask=!1}if(this._mask=t,this._mask){var e=this._mask.maskObject||this._mask;e.renderable=!1,e.isMask=!0}},Object.defineProperties(i.prototype,n),i}(n.EventEmitter);function h(t,i){return t.zIndex===i.zIndex?t._lastSortedIndex-i._lastSortedIndex:t.zIndex-i.zIndex}r.prototype.displayObjectUpdateTransform=r.prototype.updateTransform;var o=function(t){function e(){t.call(this),this.children=[],this.sortableChildren=i.settings.SORTABLE_CHILDREN,this.sortDirty=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var s={width:{configurable:!0},height:{configurable:!0}};return e.prototype.onChildrenChange=function(){},e.prototype.addChild=function(t){var i=arguments,e=arguments.length;if(e>1)for(var n=0;n<e;n++)this.addChild(i[n]);else t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this);return t},e.prototype.addChildAt=function(t,i){if(i<0||i>this.children.length)throw new Error(t+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(i,0,t),this._boundsID++,this.onChildrenChange(i),t.emit("added",this),this.emit("childAdded",t,this,i),t},e.prototype.swapChildren=function(t,i){if(t!==i){var e=this.getChildIndex(t),n=this.getChildIndex(i);this.children[e]=i,this.children[n]=t,this.onChildrenChange(e<n?e:n)}},e.prototype.getChildIndex=function(t){var i=this.children.indexOf(t);if(-1===i)throw new Error("The supplied DisplayObject must be a child of the caller");return i},e.prototype.setChildIndex=function(t,i){if(i<0||i>=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var e=this.getChildIndex(t);n.removeItems(this.children,e,1),this.children.splice(i,0,t),this.onChildrenChange(i)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(t){var i=arguments,e=arguments.length;if(e>1)for(var s=0;s<e;s++)this.removeChild(i[s]);else{var r=this.children.indexOf(t);if(-1===r)return null;t.parent=null,t.transform._parentID=-1,n.removeItems(this.children,r,1),this._boundsID++,this.onChildrenChange(r),t.emit("removed",this),this.emit("childRemoved",t,this,r)}return t},e.prototype.removeChildAt=function(t){var i=this.getChildAt(t);return i.parent=null,i.transform._parentID=-1,n.removeItems(this.children,t,1),this._boundsID++,this.onChildrenChange(t),i.emit("removed",this),this.emit("childRemoved",i,this,t),i},e.prototype.removeChildren=function(t,i){void 0===t&&(t=0);var e,n=t,s="number"==typeof i?i:this.children.length,r=s-n;if(r>0&&r<=s){e=this.children.splice(n,r);for(var h=0;h<e.length;++h)e[h].parent=null,e[h].transform&&(e[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(var o=0;o<e.length;++o)e[o].emit("removed",this),this.emit("childRemoved",e[o],this,o);return e}if(0===r&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,i=0,e=this.children.length;i<e;++i){var n=this.children[i];n._lastSortedIndex=i,t||0===n.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(h),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,i=this.children.length;t<i;++t){var e=this.children[t];e.visible&&e.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var i=this.children[t];if(i.visible&&i.renderable)if(i.calculateBounds(),i._mask){var e=i._mask.maskObject||i._mask;e.calculateBounds(),this._bounds.addBoundsMask(i._bounds,e._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._lastBoundsID=this._boundsID},e.prototype._calculateBounds=function(){},e.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else{this._render(t);for(var i=0,e=this.children.length;i<e;++i)this.children[i].render(t)}},e.prototype.renderAdvanced=function(t){t.batch.flush();var i=this.filters,e=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var n=0;n<i.length;n++)i[n].enabled&&this._enabledFilters.push(i[n]);this._enabledFilters.length&&t.filter.push(this,this._enabledFilters)}e&&t.mask.push(this,this._mask),this._render(t);for(var s=0,r=this.children.length;s<r;s++)this.children[s].render(t);t.batch.flush(),e&&t.mask.pop(this,this._mask),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(i){t.prototype.destroy.call(this),this.sortDirty=!1;var e="boolean"==typeof i?i:i&&i.children,n=this.removeChildren(0,this.children.length);if(e)for(var s=0;s<n.length;++s)n[s].destroy(i)},s.width.get=function(){return this.scale.x*this.getLocalBounds().width},s.width.set=function(t){var i=this.getLocalBounds().width;this.scale.x=0!==i?t/i:1,this._width=t},s.height.get=function(){return this.scale.y*this.getLocalBounds().height},s.height.set=function(t){var i=this.getLocalBounds().height;this.scale.y=0!==i?t/i:1,this._height=t},Object.defineProperties(e.prototype,s),e}(r);return o.prototype.containerUpdateTransform=o.prototype.updateTransform,t.Bounds=s,t.Container=o,t.DisplayObject=r,t}({},PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_display);
this.PIXI=this.PIXI||{};var _pixi_display=function(t,i,e,n){"use strict";i.settings.SORTABLE_CHILDREN=!1;var r=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?e.Rectangle.EMPTY:((t=t||new e.Rectangle(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addQuad=function(t){var i=this.minX,e=this.minY,n=this.maxX,r=this.maxY,s=t[0],o=t[1];i=s<i?s:i,e=o<e?o:e,n=s>n?s:n,r=o>r?o:r,i=(s=t[2])<i?s:i,e=(o=t[3])<e?o:e,n=s>n?s:n,r=o>r?o:r,i=(s=t[4])<i?s:i,e=(o=t[5])<e?o:e,n=s>n?s:n,r=o>r?o:r,i=(s=t[6])<i?s:i,e=(o=t[7])<e?o:e,n=s>n?s:n,r=o>r?o:r,this.minX=i,this.minY=e,this.maxX=n,this.maxY=r},t.prototype.addFrame=function(t,i,e,n,r){this.addFrameMatrix(t.worldTransform,i,e,n,r)},t.prototype.addFrameMatrix=function(t,i,e,n,r){var s=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,d=t.ty,p=this.minX,m=this.minY,u=this.maxX,c=this.maxY,f=s*i+a*e+l,y=o*i+h*e+d;p=f<p?f:p,m=y<m?y:m,u=f>u?f:u,c=y>c?y:c,p=(f=s*n+a*e+l)<p?f:p,m=(y=o*n+h*e+d)<m?y:m,u=f>u?f:u,c=y>c?y:c,p=(f=s*i+a*r+l)<p?f:p,m=(y=o*i+h*r+d)<m?y:m,u=f>u?f:u,c=y>c?y:c,p=(f=s*n+a*r+l)<p?f:p,m=(y=o*n+h*r+d)<m?y:m,u=f>u?f:u,c=y>c?y:c,this.minX=p,this.minY=m,this.maxX=u,this.maxY=c},t.prototype.addVertexData=function(t,i,e){for(var n=this.minX,r=this.minY,s=this.maxX,o=this.maxY,a=i;a<e;a+=2){var h=t[a],l=t[a+1];n=h<n?h:n,r=l<r?l:r,s=h>s?h:s,o=l>o?l:o}this.minX=n,this.minY=r,this.maxX=s,this.maxY=o},t.prototype.addVertices=function(t,i,e,n){this.addVerticesMatrix(t.worldTransform,i,e,n)},t.prototype.addVerticesMatrix=function(t,i,e,n,r,s){void 0===r&&(r=0),void 0===s&&(s=r);for(var o=t.a,a=t.b,h=t.c,l=t.d,d=t.tx,p=t.ty,m=this.minX,u=this.minY,c=this.maxX,f=this.maxY,y=e;y<n;y+=2){var b=i[y],x=i[y+1],_=o*b+h*x+d,v=l*x+a*b+p;m=Math.min(m,_-r),c=Math.max(c,_+r),u=Math.min(u,v-s),f=Math.max(f,v+s)}this.minX=m,this.minY=u,this.maxX=c,this.maxY=f},t.prototype.addBounds=function(t){var i=this.minX,e=this.minY,n=this.maxX,r=this.maxY;this.minX=t.minX<i?t.minX:i,this.minY=t.minY<e?t.minY:e,this.maxX=t.maxX>n?t.maxX:n,this.maxY=t.maxY>r?t.maxY:r},t.prototype.addBoundsMask=function(t,i){var e=t.minX>i.minX?t.minX:i.minX,n=t.minY>i.minY?t.minY:i.minY,r=t.maxX<i.maxX?t.maxX:i.maxX,s=t.maxY<i.maxY?t.maxY:i.maxY;if(e<=r&&n<=s){var o=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=e<o?e:o,this.minY=n<a?n:a,this.maxX=r>h?r:h,this.maxY=s>l?s:l}},t.prototype.addBoundsMatrix=function(t,i){this.addFrameMatrix(i,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,i){var e=t.minX>i.x?t.minX:i.x,n=t.minY>i.y?t.minY:i.y,r=t.maxX<i.x+i.width?t.maxX:i.x+i.width,s=t.maxY<i.y+i.height?t.maxY:i.y+i.height;if(e<=r&&n<=s){var o=this.minX,a=this.minY,h=this.maxX,l=this.maxY;this.minX=e<o?e:o,this.minY=n<a?n:a,this.maxX=r>h?r:h,this.maxY=s>l?s:l}},t.prototype.pad=function(t,i){void 0===t&&(t=0),void 0===i&&(i=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=i,this.maxY+=i)},t.prototype.addFramePad=function(t,i,e,n,r,s){t-=r,i-=s,e+=r,n+=s,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>e?this.maxX:e,this.minY=this.minY<i?this.minY:i,this.maxY=this.maxY>n?this.maxY:n},t}(),s=function(t,i){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)i.hasOwnProperty(e)&&(t[e]=i[e])})(t,i)};function o(t,i){function e(){this.constructor=t}s(t,i),t.prototype=null===i?Object.create(i):(e.prototype=i.prototype,new e)}var a=function(t){function i(){var i=t.call(this)||this;return i.tempDisplayObjectParent=null,i.transform=new e.Transform,i.alpha=1,i.visible=!0,i.renderable=!0,i.parent=null,i.worldAlpha=1,i._lastSortedIndex=0,i._zIndex=0,i.filterArea=null,i.filters=null,i._enabledFilters=null,i._bounds=new r,i._localBounds=null,i._boundsID=0,i._boundsRect=null,i._localBoundsRect=null,i._mask=null,i._destroyed=!1,i.isSprite=!1,i.isMask=!1,i}return o(i,t),i.mixin=function(t){for(var e=Object.keys(t),n=0;n<e.length;++n){var r=e[n];Object.defineProperty(i.prototype,r,Object.getOwnPropertyDescriptor(t,r))}},i.prototype._recursivePostUpdateTransform=function(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)},i.prototype.updateTransform=function(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha},i.prototype.getBounds=function(t,i){return t||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),i||(this._boundsRect||(this._boundsRect=new e.Rectangle),i=this._boundsRect),this._bounds.getRectangle(i)},i.prototype.getLocalBounds=function(t){t||(this._localBoundsRect||(this._localBoundsRect=new e.Rectangle),t=this._localBoundsRect),this._localBounds||(this._localBounds=new r);var i=this.transform,n=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;var s=this._bounds,o=this._boundsID;this._bounds=this._localBounds;var a=this.getBounds(!1,t);return this.parent=n,this.transform=i,this._bounds=s,this._bounds.updateID+=this._boundsID-o,a},i.prototype.toGlobal=function(t,i,e){return void 0===e&&(e=!1),e||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,i)},i.prototype.toLocal=function(t,i,e,n){return i&&(t=i.toGlobal(t,e,n)),n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,e)},i.prototype.setParent=function(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t},i.prototype.setTransform=function(t,i,e,n,r,s,o,a,h){return void 0===t&&(t=0),void 0===i&&(i=0),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0),this.position.x=t,this.position.y=i,this.scale.x=e||1,this.scale.y=n||1,this.rotation=r,this.skew.x=s,this.skew.y=o,this.pivot.x=a,this.pivot.y=h,this},i.prototype.destroy=function(t){this.parent&&this.parent.removeChild(this),this.removeAllListeners(),this.transform=null,this.parent=null,this._bounds=null,this._mask=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this._destroyed=!0},Object.defineProperty(i.prototype,"_tempDisplayObjectParent",{get:function(){return null===this.tempDisplayObjectParent&&(this.tempDisplayObjectParent=new h),this.tempDisplayObjectParent},enumerable:!1,configurable:!0}),i.prototype.enableTempParent=function(){var t=this.parent;return this.parent=this._tempDisplayObjectParent,t},i.prototype.disableTempParent=function(t){this.parent=t},Object.defineProperty(i.prototype,"x",{get:function(){return this.position.x},set:function(t){this.transform.position.x=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"y",{get:function(){return this.position.y},set:function(t){this.transform.position.y=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"worldTransform",{get:function(){return this.transform.worldTransform},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"localTransform",{get:function(){return this.transform.localTransform},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"position",{get:function(){return this.transform.position},set:function(t){this.transform.position.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"scale",{get:function(){return this.transform.scale},set:function(t){this.transform.scale.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"pivot",{get:function(){return this.transform.pivot},set:function(t){this.transform.pivot.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"skew",{get:function(){return this.transform.skew},set:function(t){this.transform.skew.copyFrom(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"rotation",{get:function(){return this.transform.rotation},set:function(t){this.transform.rotation=t},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"angle",{get:function(){return this.transform.rotation*e.RAD_TO_DEG},set:function(t){this.transform.rotation=t*e.DEG_TO_RAD},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"worldVisible",{get:function(){var t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"mask",{get:function(){return this._mask},set:function(t){var i;this._mask&&((i=this._mask.maskObject||this._mask).renderable=!0,i.isMask=!1);(this._mask=t,this._mask)&&((i=this._mask.maskObject||this._mask).renderable=!1,i.isMask=!0)},enumerable:!1,configurable:!0}),i}(n.EventEmitter),h=function(t){function i(){var i=null!==t&&t.apply(this,arguments)||this;return i.sortDirty=null,i}return o(i,t),i}(a);function l(t,i){return t.zIndex===i.zIndex?t._lastSortedIndex-i._lastSortedIndex:t.zIndex-i.zIndex}a.prototype.displayObjectUpdateTransform=a.prototype.updateTransform;var d=function(t){function e(){var e=t.call(this)||this;return e.children=[],e.sortableChildren=i.settings.SORTABLE_CHILDREN,e.sortDirty=!1,e}return o(e,t),e.prototype.onChildrenChange=function(t){},e.prototype.addChild=function(){for(var t=arguments,i=[],e=0;e<arguments.length;e++)i[e]=t[e];if(i.length>1)for(var n=0;n<i.length;n++)this.addChild(i[n]);else{var r=i[0];r.parent&&r.parent.removeChild(r),r.parent=this,this.sortDirty=!0,r.transform._parentID=-1,this.children.push(r),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",r,this,this.children.length-1),r.emit("added",this)}return i[0]},e.prototype.addChildAt=function(t,i){if(i<0||i>this.children.length)throw new Error(t+"addChildAt: The index "+i+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(i,0,t),this._boundsID++,this.onChildrenChange(i),t.emit("added",this),this.emit("childAdded",t,this,i),t},e.prototype.swapChildren=function(t,i){if(t!==i){var e=this.getChildIndex(t),n=this.getChildIndex(i);this.children[e]=i,this.children[n]=t,this.onChildrenChange(e<n?e:n)}},e.prototype.getChildIndex=function(t){var i=this.children.indexOf(t);if(-1===i)throw new Error("The supplied DisplayObject must be a child of the caller");return i},e.prototype.setChildIndex=function(t,i){if(i<0||i>=this.children.length)throw new Error("The index "+i+" supplied is out of bounds "+this.children.length);var e=this.getChildIndex(t);n.removeItems(this.children,e,1),this.children.splice(i,0,t),this.onChildrenChange(i)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,i=[],e=0;e<arguments.length;e++)i[e]=t[e];if(i.length>1)for(var r=0;r<i.length;r++)this.removeChild(i[r]);else{var s=i[0],o=this.children.indexOf(s);if(-1===o)return null;s.parent=null,s.transform._parentID=-1,n.removeItems(this.children,o,1),this._boundsID++,this.onChildrenChange(o),s.emit("removed",this),this.emit("childRemoved",s,this,o)}return i[0]},e.prototype.removeChildAt=function(t){var i=this.getChildAt(t);return i.parent=null,i.transform._parentID=-1,n.removeItems(this.children,t,1),this._boundsID++,this.onChildrenChange(t),i.emit("removed",this),this.emit("childRemoved",i,this,t),i},e.prototype.removeChildren=function(t,i){void 0===t&&(t=0),void 0===i&&(i=this.children.length);var e,n=t,r=i-n;if(r>0&&r<=i){e=this.children.splice(n,r);for(var s=0;s<e.length;++s)e[s].parent=null,e[s].transform&&(e[s].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(s=0;s<e.length;++s)e[s].emit("removed",this),this.emit("childRemoved",e[s],this,s);return e}if(0===r&&0===this.children.length)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},e.prototype.sortChildren=function(){for(var t=!1,i=0,e=this.children.length;i<e;++i){var n=this.children[i];n._lastSortedIndex=i,t||0===n.zIndex||(t=!0)}t&&this.children.length>1&&this.children.sort(l),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,i=this.children.length;t<i;++t){var e=this.children[t];e.visible&&e.updateTransform()}},e.prototype.calculateBounds=function(){this._bounds.clear(),this._calculateBounds();for(var t=0;t<this.children.length;t++){var i=this.children[t];if(i.visible&&i.renderable)if(i.calculateBounds(),i._mask){var e=i._mask.maskObject||i._mask;e.calculateBounds(),this._bounds.addBoundsMask(i._bounds,e._bounds)}else i.filterArea?this._bounds.addBoundsArea(i._bounds,i.filterArea):this._bounds.addBounds(i._bounds)}this._bounds.updateID=this._boundsID},e.prototype.getLocalBounds=function(i,e){void 0===e&&(e=!1);var n=t.prototype.getLocalBounds.call(this,i);if(!e)for(var r=0,s=this.children.length;r<s;++r){var o=this.children[r];o.visible&&o.updateTransform()}return n},e.prototype._calculateBounds=function(){},e.prototype.render=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.renderable)if(this._mask||this.filters&&this.filters.length)this.renderAdvanced(t);else{this._render(t);for(var i=0,e=this.children.length;i<e;++i)this.children[i].render(t)}},e.prototype.renderAdvanced=function(t){t.batch.flush();var i=this.filters,e=this._mask;if(i){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(var n=0;n<i.length;n++)i[n].enabled&&this._enabledFilters.push(i[n]);this._enabledFilters.length&&t.filter.push(this,this._enabledFilters)}e&&t.mask.push(this,this._mask),this._render(t);n=0;for(var r=this.children.length;n<r;n++)this.children[n].render(t);t.batch.flush(),e&&t.mask.pop(this),i&&this._enabledFilters&&this._enabledFilters.length&&t.filter.pop()},e.prototype._render=function(t){},e.prototype.destroy=function(i){t.prototype.destroy.call(this),this.sortDirty=!1;var e="boolean"==typeof i?i:i&&i.children,n=this.removeChildren(0,this.children.length);if(e)for(var r=0;r<n.length;++r)n[r].destroy(i)},Object.defineProperty(e.prototype,"width",{get:function(){return this.scale.x*this.getLocalBounds().width},set:function(t){var i=this.getLocalBounds().width;this.scale.x=0!==i?t/i:1,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.scale.y*this.getLocalBounds().height},set:function(t){var i=this.getLocalBounds().height;this.scale.y=0!==i?t/i:1,this._height=t},enumerable:!1,configurable:!0}),e}(a);return d.prototype.containerUpdateTransform=d.prototype.updateTransform,t.Bounds=r,t.Container=d,t.DisplayObject=a,t.TemporaryDisplayObject=h,t}({},PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_display);
//# sourceMappingURL=display.min.js.map
/*!
* @pixi/display - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/display - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
*

@@ -9,3 +9,3 @@ * @pixi/display is licensed under the MIT License.

import { settings } from '@pixi/settings';
import { Rectangle, RAD_TO_DEG, DEG_TO_RAD, Transform } from '@pixi/math';
import { Rectangle, Transform, RAD_TO_DEG, DEG_TO_RAD } from '@pixi/math';
import { EventEmitter, removeItems } from '@pixi/utils';

@@ -43,228 +43,93 @@

*/
var Bounds = function Bounds()
{
var Bounds = /** @class */ (function () {
function Bounds() {
/**
* @member {number}
* @default 0
*/
this.minX = Infinity;
/**
* @member {number}
* @default 0
*/
this.minY = Infinity;
/**
* @member {number}
* @default 0
*/
this.maxX = -Infinity;
/**
* @member {number}
* @default 0
*/
this.maxY = -Infinity;
this.rect = null;
/**
* It is updated to _boundsID of corresponding object to keep bounds in sync with content.
* Updated from outside, thus public modifier.
*
* @member {number}
* @public
*/
this.updateID = -1;
}
/**
* @member {number}
* @default 0
* Checks if bounds are empty.
*
* @return {boolean} True if empty.
*/
this.minX = Infinity;
Bounds.prototype.isEmpty = function () {
return this.minX > this.maxX || this.minY > this.maxY;
};
/**
* @member {number}
* @default 0
* Clears the bounds and resets.
*
*/
this.minY = Infinity;
Bounds.prototype.clear = function () {
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
};
/**
* @member {number}
* @default 0
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
*
* @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty
* @returns {PIXI.Rectangle} A rectangle of the bounds
*/
this.maxX = -Infinity;
Bounds.prototype.getRectangle = function (rect) {
if (this.minX > this.maxX || this.minY > this.maxY) {
return Rectangle.EMPTY;
}
rect = rect || new Rectangle(0, 0, 1, 1);
rect.x = this.minX;
rect.y = this.minY;
rect.width = this.maxX - this.minX;
rect.height = this.maxY - this.minY;
return rect;
};
/**
* @member {number}
* @default 0
* This function should be inlined when its possible.
*
* @param {PIXI.IPointData} point - The point to add.
*/
this.maxY = -Infinity;
this.rect = null;
};
/**
* Checks if bounds are empty.
*
* @return {boolean} True if empty.
*/
Bounds.prototype.isEmpty = function isEmpty ()
{
return this.minX > this.maxX || this.minY > this.maxY;
};
/**
* Clears the bounds and resets.
*
*/
Bounds.prototype.clear = function clear ()
{
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
};
/**
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
*
* @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty
* @returns {PIXI.Rectangle} A rectangle of the bounds
*/
Bounds.prototype.getRectangle = function getRectangle (rect)
{
if (this.minX > this.maxX || this.minY > this.maxY)
{
return Rectangle.EMPTY;
}
rect = rect || new Rectangle(0, 0, 1, 1);
rect.x = this.minX;
rect.y = this.minY;
rect.width = this.maxX - this.minX;
rect.height = this.maxY - this.minY;
return rect;
};
/**
* This function should be inlined when its possible.
*
* @param {PIXI.Point} point - The point to add.
*/
Bounds.prototype.addPoint = function addPoint (point)
{
this.minX = Math.min(this.minX, point.x);
this.maxX = Math.max(this.maxX, point.x);
this.minY = Math.min(this.minY, point.y);
this.maxY = Math.max(this.maxY, point.y);
};
/**
* Adds a quad, not transformed
*
* @param {Float32Array} vertices - The verts to add.
*/
Bounds.prototype.addQuad = function addQuad (vertices)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = vertices[0];
var y = vertices[1];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[2];
y = vertices[3];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[4];
y = vertices[5];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[6];
y = vertices[7];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds sprite frame, transformed.
*
* @param {PIXI.Transform} transform - transform to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrame = function addFrame (transform, x0, y0, x1, y1)
{
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
};
/**
* Adds sprite frame, multiplied by matrix
*
* @param {PIXI.Matrix} matrix - matrix to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrameMatrix = function addFrameMatrix (matrix, x0, y0, x1, y1)
{
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = (a * x0) + (c * y0) + tx;
var y = (b * x0) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y0) + tx;
y = (b * x1) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x0) + (c * y1) + tx;
y = (b * x0) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y1) + tx;
y = (b * x1) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds screen vertices from array
*
* @param {Float32Array} vertexData - calculated vertices
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertexData = function addVertexData (vertexData, beginOffset, endOffset)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2)
{
var x = vertexData[i];
var y = vertexData[i + 1];
Bounds.prototype.addPoint = function (point) {
this.minX = Math.min(this.minX, point.x);
this.maxX = Math.max(this.maxX, point.x);
this.minY = Math.min(this.minY, point.y);
this.maxY = Math.max(this.maxY, point.y);
};
/**
* Adds a quad, not transformed
*
* @param {Float32Array} vertices - The verts to add.
*/
Bounds.prototype.addQuad = function (vertices) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = vertices[0];
var y = vertices[1];
minX = x < minX ? x : minX;

@@ -274,102 +139,53 @@ minY = y < minY ? y : minY;

maxY = y > maxY ? y : maxY;
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Transform} transform - mesh transform
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertices = function addVertices (transform, vertices, beginOffset, endOffset)
{
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Matrix} matrix - mesh matrix
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
* @param {number} [padX] - x padding
* @param {number} [padY] - y padding
*/
Bounds.prototype.addVerticesMatrix = function addVerticesMatrix (matrix, vertices, beginOffset, endOffset, padX, padY)
{
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
padX = padX || 0;
padY = padY || 0;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2)
{
var rawX = vertices[i];
var rawY = vertices[i + 1];
var x = (a * rawX) + (c * rawY) + tx;
var y = (d * rawY) + (b * rawX) + ty;
minX = Math.min(minX, x - padX);
maxX = Math.max(maxX, x + padX);
minY = Math.min(minY, y - padY);
maxY = Math.max(maxY, y + padY);
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds other Bounds
*
* @param {PIXI.Bounds} bounds - TODO
*/
Bounds.prototype.addBounds = function addBounds (bounds)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX;
this.minY = bounds.minY < minY ? bounds.minY : minY;
this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;
this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
};
/**
* Adds other Bounds, masked with Bounds
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Bounds} mask - TODO
*/
Bounds.prototype.addBoundsMask = function addBoundsMask (bounds, mask)
{
var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;
var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;
var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;
var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY)
{
x = vertices[2];
y = vertices[3];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[4];
y = vertices[5];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[6];
y = vertices[7];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds sprite frame, transformed.
*
* @param {PIXI.Transform} transform - transform to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) {
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
};
/**
* Adds sprite frame, multiplied by matrix
*
* @param {PIXI.Matrix} matrix - matrix to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) {
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;

@@ -379,36 +195,39 @@ var minY = this.minY;

var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty
*
* @param {PIXI.Bounds} bounds other bounds
* @param {PIXI.Matrix} matrix multiplicator
*/
Bounds.prototype.addBoundsMatrix = function addBoundsMatrix (bounds, matrix)
{
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
};
/**
* Adds other Bounds, masked with Rectangle
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Rectangle} area - TODO
*/
Bounds.prototype.addBoundsArea = function addBoundsArea (bounds, area)
{
var _minX = bounds.minX > area.x ? bounds.minX : area.x;
var _minY = bounds.minY > area.y ? bounds.minY : area.y;
var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);
var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);
if (_minX <= _maxX && _minY <= _maxY)
{
var x = (a * x0) + (c * y0) + tx;
var y = (b * x0) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y0) + tx;
y = (b * x1) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x0) + (c * y1) + tx;
y = (b * x0) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y1) + tx;
y = (b * x1) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds screen vertices from array
*
* @param {Float32Array} vertexData - calculated vertices
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) {
var minX = this.minX;

@@ -418,55 +237,200 @@ var minY = this.minY;

var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2) {
var x = vertexData[i];
var y = vertexData[i + 1];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Transform} transform - mesh transform
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) {
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
};
/**
* Add an array of mesh vertices.
*
* @param {PIXI.Matrix} matrix - mesh matrix
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
* @param {number} [padX=0] - x padding
* @param {number} [padY=0] - y padding
*/
Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) {
if (padX === void 0) { padX = 0; }
if (padY === void 0) { padY = padX; }
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2) {
var rawX = vertices[i];
var rawY = vertices[i + 1];
var x = (a * rawX) + (c * rawY) + tx;
var y = (d * rawY) + (b * rawX) + ty;
minX = Math.min(minX, x - padX);
maxX = Math.max(maxX, x + padX);
minY = Math.min(minY, y - padY);
maxY = Math.max(maxY, y + padY);
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds other Bounds.
*
* @param {PIXI.Bounds} bounds - The Bounds to be added
*/
Bounds.prototype.addBounds = function (bounds) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX;
this.minY = bounds.minY < minY ? bounds.minY : minY;
this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;
this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
};
/**
* Adds other Bounds, masked with Bounds.
*
* @param {PIXI.Bounds} bounds - The Bounds to be added.
* @param {PIXI.Bounds} mask - TODO
*/
Bounds.prototype.addBoundsMask = function (bounds, mask) {
var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;
var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;
var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;
var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.
*
* @param {PIXI.Bounds} bounds - other bounds
* @param {PIXI.Matrix} matrix - multiplicator
*/
Bounds.prototype.addBoundsMatrix = function (bounds, matrix) {
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
};
/**
* Adds other Bounds, masked with Rectangle.
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Rectangle} area - TODO
*/
Bounds.prototype.addBoundsArea = function (bounds, area) {
var _minX = bounds.minX > area.x ? bounds.minX : area.x;
var _minY = bounds.minY > area.y ? bounds.minY : area.y;
var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);
var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);
if (_minX <= _maxX && _minY <= _maxY) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Pads bounds object, making it grow in all directions.
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
*
* @param {number} [paddingX=0] - The horizontal padding amount.
* @param {number} [paddingY=0] - The vertical padding amount.
*/
Bounds.prototype.pad = function (paddingX, paddingY) {
if (paddingX === void 0) { paddingX = 0; }
if (paddingY === void 0) { paddingY = paddingX; }
if (!this.isEmpty()) {
this.minX -= paddingX;
this.maxX += paddingX;
this.minY -= paddingY;
this.maxY += paddingY;
}
};
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
*
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
* @param {number} padX - padding X
* @param {number} padY - padding Y
*/
Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) {
x0 -= padX;
y0 -= padY;
x1 += padX;
y1 += padY;
this.minX = this.minX < x0 ? this.minX : x0;
this.maxX = this.maxX > x1 ? this.maxX : x1;
this.minY = this.minY < y0 ? this.minY : y0;
this.maxY = this.maxY > y1 ? this.maxY : y1;
};
return Bounds;
}());
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
/**
* Pads bounds object, making it grow in all directions.
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
*
* @param {number} [paddingX=0] - The horizontal padding amount.
* @param {number} [paddingY=0] - The vertical padding amount.
*/
Bounds.prototype.pad = function pad (paddingX, paddingY)
{
paddingX = paddingX || 0;
paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0);
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
if (!this.isEmpty())
{
this.minX -= paddingX;
this.maxX += paddingX;
this.minY -= paddingY;
this.maxY += paddingY;
}
};
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
*
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
* @param {number} padX - padding X
* @param {number} padY - padding Y
*/
Bounds.prototype.addFramePad = function addFramePad (x0, y0, x1, y1, padX, padY)
{
x0 -= padX;
y0 -= padY;
x1 += padX;
y1 += padY;
this.minX = this.minX < x0 ? this.minX : x0;
this.maxX = this.maxX > x1 ? this.maxX : x1;
this.minY = this.minY < y0 ? this.minY : y0;
this.maxY = this.maxY > y1 ? this.maxY : y1;
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
return extendStatics(d, b);
};
// _tempDisplayObjectParent = new DisplayObject();
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

@@ -476,3 +440,3 @@ /**

*
* This is an abstract class and should not be used on its own; rather it should be extended.
* This is an abstract class and should not be used on its own; rather it should b e extended.
*

@@ -483,9 +447,7 @@ * @class

*/
var DisplayObject = /*@__PURE__*/(function (EventEmitter) {
function DisplayObject()
{
EventEmitter.call(this);
this.tempDisplayObjectParent = null;
var DisplayObject = /** @class */ (function (_super) {
__extends(DisplayObject, _super);
function DisplayObject() {
var _this = _super.call(this) || this;
_this.tempDisplayObjectParent = null;
// TODO: need to create Transform from factory

@@ -498,4 +460,3 @@ /**

*/
this.transform = new Transform();
_this.transform = new Transform();
/**

@@ -506,4 +467,3 @@ * The opacity of the object.

*/
this.alpha = 1;
_this.alpha = 1;
/**

@@ -517,4 +477,3 @@ * The visibility of the object. If false the object will not be drawn, and

*/
this.visible = true;
_this.visible = true;
/**

@@ -528,4 +487,3 @@ * Can this object be rendered, if false the object will not be drawn but the updateTransform

*/
this.renderable = true;
_this.renderable = true;
/**

@@ -535,6 +493,4 @@ * The display object container that contains this display object.

* @member {PIXI.Container}
* @readonly
*/
this.parent = null;
_this.parent = null;
/**

@@ -546,4 +502,3 @@ * The multiplied alpha of the displayObject.

*/
this.worldAlpha = 1;
_this.worldAlpha = 1;
/**

@@ -556,4 +511,3 @@ * Which index in the children array the display component was before the previous zIndex sort.

*/
this._lastSortedIndex = 0;
_this._lastSortedIndex = 0;
/**

@@ -566,4 +520,3 @@ * The zIndex of the displayObject.

*/
this._zIndex = 0;
_this._zIndex = 0;
/**

@@ -577,4 +530,3 @@ * The area the filter is applied to. This is used as more of an optimization

*/
this.filterArea = null;
_this.filterArea = null;
/**

@@ -587,25 +539,49 @@ * Sets the filters for the displayObject.

*/
this.filters = null;
this._enabledFilters = null;
_this.filters = null;
/**
* Currently enabled filters
* @member {PIXI.Filter[]}
* @protected
*/
_this._enabledFilters = null;
/**
* The bounds object, this is used to calculate and store the bounds of the displayObject.
*
* @member {PIXI.Bounds}
*/
_this._bounds = new Bounds();
/**
* Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.
*
* @member {PIXI.Bounds}
*/
_this._localBounds = null;
/**
* Flags the cached bounds as dirty.
*
* @member {number}
* @protected
*/
this._bounds = new Bounds();
this._boundsID = 0;
this._lastBoundsID = -1;
this._boundsRect = null;
this._localBoundsRect = null;
_this._boundsID = 0;
/**
* Cache of this display-object's bounds-rectangle.
*
* @member {PIXI.Bounds}
* @protected
*/
_this._boundsRect = null;
/**
* Cache of this display-object's local-bounds rectangle.
*
* @member {PIXI.Bounds}
* @protected
*/
_this._localBoundsRect = null;
/**
* The original, cached mask of the object.
*
* @member {PIXI.Graphics|PIXI.Sprite|null}
* @member {PIXI.Container|PIXI.MaskData|null}
* @protected
*/
this._mask = null;
_this._mask = null;
/**

@@ -617,3 +593,2 @@ * Fired when this DisplayObject is added to a Container.

*/
/**

@@ -625,3 +600,2 @@ * Fired when this DisplayObject is removed from a Container.

*/
/**

@@ -633,4 +607,3 @@ * If the object has been destroyed via destroy(). If true, it should not be used.

*/
this._destroyed = false;
_this._destroyed = false;
/**

@@ -640,4 +613,3 @@ * used to fast check if a sprite is.. a sprite!

*/
this.isSprite = false;
_this.isSprite = false;
/**

@@ -647,47 +619,35 @@ * Does any other displayObject use this object as a mask?

*/
this.isMask = false;
_this.isMask = false;
return _this;
}
if ( EventEmitter ) DisplayObject.__proto__ = EventEmitter;
DisplayObject.prototype = Object.create( EventEmitter && EventEmitter.prototype );
DisplayObject.prototype.constructor = DisplayObject;
var prototypeAccessors = { _tempDisplayObjectParent: { configurable: true },x: { configurable: true },y: { configurable: true },worldTransform: { configurable: true },localTransform: { configurable: true },position: { configurable: true },scale: { configurable: true },pivot: { configurable: true },skew: { configurable: true },rotation: { configurable: true },angle: { configurable: true },zIndex: { configurable: true },worldVisible: { configurable: true },mask: { configurable: true } };
/**
* @protected
* @member {PIXI.DisplayObject}
* Mixes all enumerable properties and methods from a source object to DisplayObject.
*
* @param {object} source - The source of properties and methods to mix in.
*/
DisplayObject.mixin = function mixin (source)
{
DisplayObject.mixin = function (source) {
// in ES8/ES2017, this would be really easy:
// Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
// Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));
// get all the enumerable property keys
var keys = Object.keys(source);
// loop through properties
for (var i = 0; i < keys.length; ++i)
{
for (var i = 0; i < keys.length; ++i) {
var propertyName = keys[i];
// Set the property using the property descriptor - this works for accessors and normal value properties
Object.defineProperty(
DisplayObject.prototype,
propertyName,
Object.getOwnPropertyDescriptor(source, propertyName)
);
Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
}
};
prototypeAccessors._tempDisplayObjectParent.get = function ()
{
if (this.tempDisplayObjectParent === null)
{
this.tempDisplayObjectParent = new DisplayObject();
/**
* Recursively updates transform of all objects from the root to this one
* internal function for toLocal()
*/
DisplayObject.prototype._recursivePostUpdateTransform = function () {
if (this.parent) {
this.parent._recursivePostUpdateTransform();
this.transform.updateTransform(this.parent.transform);
}
return this.tempDisplayObjectParent;
else {
this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
};
/**

@@ -698,6 +658,4 @@ * Updates the object transform for rendering.

*/
DisplayObject.prototype.updateTransform = function updateTransform ()
{
DisplayObject.prototype.updateTransform = function () {
this._boundsID++;
this.transform.updateTransform(this.parent.transform);

@@ -707,31 +665,3 @@ // multiply the alphas..

};
/**
* Recalculates the bounds of the display object.
*
* Does nothing by default and can be overwritten in a parent class.
*/
DisplayObject.prototype.calculateBounds = function calculateBounds ()
{
// OVERWRITE;
};
/**
* Recursively updates transform of all objects from the root to this one
* internal function for toLocal()
*/
DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform ()
{
if (this.parent)
{
this.parent._recursivePostUpdateTransform();
this.transform.updateTransform(this.parent.transform);
}
else
{
this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
};
/**
* Retrieves the bounds of the displayObject as a rectangle object.

@@ -745,8 +675,5 @@ *

*/
DisplayObject.prototype.getBounds = function getBounds (skipUpdate, rect)
{
if (!skipUpdate)
{
if (!this.parent)
{
DisplayObject.prototype.getBounds = function (skipUpdate, rect) {
if (!skipUpdate) {
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -756,4 +683,3 @@ this.updateTransform();

}
else
{
else {
this._recursivePostUpdateTransform();

@@ -763,22 +689,14 @@ this.updateTransform();

}
if (this._boundsID !== this._lastBoundsID)
{
if (this._bounds.updateID !== this._boundsID) {
this.calculateBounds();
this._lastBoundsID = this._boundsID;
this._bounds.updateID = this._boundsID;
}
if (!rect)
{
if (!this._boundsRect)
{
if (!rect) {
if (!this._boundsRect) {
this._boundsRect = new Rectangle();
}
rect = this._boundsRect;
}
return this._bounds.getRectangle(rect);
};
/**

@@ -790,50 +708,43 @@ * Retrieves the local bounds of the displayObject as a rectangle object.

*/
DisplayObject.prototype.getLocalBounds = function getLocalBounds (rect)
{
DisplayObject.prototype.getLocalBounds = function (rect) {
if (!rect) {
if (!this._localBoundsRect) {
this._localBoundsRect = new Rectangle();
}
rect = this._localBoundsRect;
}
if (!this._localBounds) {
this._localBounds = new Bounds();
}
var transformRef = this.transform;
var parentRef = this.parent;
this.parent = null;
this.transform = this._tempDisplayObjectParent.transform;
if (!rect)
{
if (!this._localBoundsRect)
{
this._localBoundsRect = new Rectangle();
}
rect = this._localBoundsRect;
}
var worldBounds = this._bounds;
var worldBoundsID = this._boundsID;
this._bounds = this._localBounds;
var bounds = this.getBounds(false, rect);
this.parent = parentRef;
this.transform = transformRef;
this._bounds = worldBounds;
this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects
return bounds;
};
/**
* Calculates the global position of the display object.
*
* @param {PIXI.IPoint} position - The world origin to calculate from.
* @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
* @param {PIXI.IPointData} position - The world origin to calculate from.
* @param {PIXI.Point} [point] - A Point object in which to store the value, optional
* (otherwise will create a new Point).
* @param {boolean} [skipUpdate=false] - Should we skip the update transform.
* @return {PIXI.IPoint} A point object representing the position of this object.
* @return {PIXI.Point} A point object representing the position of this object.
*/
DisplayObject.prototype.toGlobal = function toGlobal (position, point, skipUpdate)
{
if ( skipUpdate === void 0 ) skipUpdate = false;
if (!skipUpdate)
{
DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) {
if (skipUpdate === void 0) { skipUpdate = false; }
if (!skipUpdate) {
this._recursivePostUpdateTransform();
// this parent check is for just in case the item is a root object.
// If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
// this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
if (!this.parent)
{
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -843,38 +754,29 @@ this.displayObjectUpdateTransform();

}
else
{
else {
this.displayObjectUpdateTransform();
}
}
// don't need to update the lot
return this.worldTransform.apply(position, point);
};
/**
* Calculates the local position of the display object relative to another point.
*
* @param {PIXI.IPoint} position - The world origin to calculate from.
* @param {PIXI.IPointData} position - The world origin to calculate from.
* @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.
* @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
* @param {PIXI.Point} [point] - A Point object in which to store the value, optional
* (otherwise will create a new Point).
* @param {boolean} [skipUpdate=false] - Should we skip the update transform
* @return {PIXI.IPoint} A point object representing the position of this object
* @return {PIXI.Point} A point object representing the position of this object
*/
DisplayObject.prototype.toLocal = function toLocal (position, from, point, skipUpdate)
{
if (from)
{
DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) {
if (from) {
position = from.toGlobal(position, point, skipUpdate);
}
if (!skipUpdate)
{
if (!skipUpdate) {
this._recursivePostUpdateTransform();
// this parent check is for just in case the item is a root object.
// If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
// this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
if (!this.parent)
{
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -884,23 +786,10 @@ this.displayObjectUpdateTransform();

}
else
{
else {
this.displayObjectUpdateTransform();
}
}
// simply apply the matrix..
return this.worldTransform.applyInverse(position, point);
};
/**
* Renders the object using the WebGL renderer.
*
* @param {PIXI.Renderer} renderer - The renderer.
*/
DisplayObject.prototype.render = function render (renderer) // eslint-disable-line no-unused-vars
{
// OVERWRITE;
};
/**
* Set the parent Container of this DisplayObject.

@@ -911,14 +800,9 @@ *

*/
DisplayObject.prototype.setParent = function setParent (container)
{
if (!container || !container.addChild)
{
DisplayObject.prototype.setParent = function (container) {
if (!container || !container.addChild) {
throw new Error('setParent: Argument must be a Container');
}
container.addChild(this);
return container;
};
/**

@@ -938,14 +822,12 @@ * Convenience function to set the position, scale, skew and pivot at once.

*/
DisplayObject.prototype.setTransform = function setTransform (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY)
{
if ( x === void 0 ) x = 0;
if ( y === void 0 ) y = 0;
if ( scaleX === void 0 ) scaleX = 1;
if ( scaleY === void 0 ) scaleY = 1;
if ( rotation === void 0 ) rotation = 0;
if ( skewX === void 0 ) skewX = 0;
if ( skewY === void 0 ) skewY = 0;
if ( pivotX === void 0 ) pivotX = 0;
if ( pivotY === void 0 ) pivotY = 0;
DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) {
if (x === void 0) { x = 0; }
if (y === void 0) { y = 0; }
if (scaleX === void 0) { scaleX = 1; }
if (scaleY === void 0) { scaleY = 1; }
if (rotation === void 0) { rotation = 0; }
if (skewX === void 0) { skewX = 0; }
if (skewY === void 0) { skewY = 0; }
if (pivotX === void 0) { pivotX = 0; }
if (pivotY === void 0) { pivotY = 0; }
this.position.x = x;

@@ -960,6 +842,4 @@ this.position.y = y;

this.pivot.y = pivotY;
return this;
};
/**

@@ -972,6 +852,4 @@ * Base destroy method for generic display objects. This will automatically

*/
DisplayObject.prototype.destroy = function destroy ()
{
if (this.parent)
{
DisplayObject.prototype.destroy = function (_options) {
if (this.parent) {
this.parent.removeChild(this);

@@ -981,263 +859,295 @@ }

this.transform = null;
this.parent = null;
this._bounds = null;
this._currentBounds = null;
this._mask = null;
this.filters = null;
this.filterArea = null;
this.hitArea = null;
this.interactive = false;
this.interactiveChildren = false;
this._destroyed = true;
};
Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", {
/**
* @protected
* @member {PIXI.Container}
*/
get: function () {
if (this.tempDisplayObjectParent === null) {
// eslint-disable-next-line no-use-before-define
this.tempDisplayObjectParent = new TemporaryDisplayObject();
}
return this.tempDisplayObjectParent;
},
enumerable: false,
configurable: true
});
/**
* The position of the displayObject on the x axis relative to the local coordinates of the parent.
* An alias to position.x
* Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root
*
* @member {number}
*/
prototypeAccessors.x.get = function ()
{
return this.position.x;
};
prototypeAccessors.x.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.x = value;
};
/**
* The position of the displayObject on the y axis relative to the local coordinates of the parent.
* An alias to position.y
* ```
* const cacheParent = elem.enableTempParent();
* elem.updateTransform();
* elem.disableTempParent(cacheParent);
* ```
*
* @member {number}
* @returns {PIXI.DisplayObject} current parent
*/
prototypeAccessors.y.get = function ()
{
return this.position.y;
DisplayObject.prototype.enableTempParent = function () {
var myParent = this.parent;
this.parent = this._tempDisplayObjectParent;
return myParent;
};
prototypeAccessors.y.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.y = value;
};
/**
* Current transform of the object based on world (parent) factors.
*
* @member {PIXI.Matrix}
* @readonly
* Pair method for `enableTempParent`
* @param {PIXI.DisplayObject} cacheParent actual parent of element
*/
prototypeAccessors.worldTransform.get = function ()
{
return this.transform.worldTransform;
DisplayObject.prototype.disableTempParent = function (cacheParent) {
this.parent = cacheParent;
};
/**
* Current transform of the object based on local factors: position, scale, other stuff.
*
* @member {PIXI.Matrix}
* @readonly
*/
prototypeAccessors.localTransform.get = function ()
{
return this.transform.localTransform;
};
/**
* The coordinate of the object relative to the local coordinates of the parent.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.position.get = function ()
{
return this.transform.position;
};
prototypeAccessors.position.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.copyFrom(value);
};
/**
* The scale factor of the object.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.scale.get = function ()
{
return this.transform.scale;
};
prototypeAccessors.scale.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.scale.copyFrom(value);
};
/**
* The pivot point of the displayObject that it rotates around.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.pivot.get = function ()
{
return this.transform.pivot;
};
prototypeAccessors.pivot.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.pivot.copyFrom(value);
};
/**
* The skew factor for the object in radians.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
prototypeAccessors.skew.get = function ()
{
return this.transform.skew;
};
prototypeAccessors.skew.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.skew.copyFrom(value);
};
/**
* The rotation of the object in radians.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
prototypeAccessors.rotation.get = function ()
{
return this.transform.rotation;
};
prototypeAccessors.rotation.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.rotation = value;
};
/**
* The angle of the object in degrees.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
prototypeAccessors.angle.get = function ()
{
return this.transform.rotation * RAD_TO_DEG;
};
prototypeAccessors.angle.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.rotation = value * DEG_TO_RAD;
};
/**
* The zIndex of the displayObject.
* If a container has the sortableChildren property set to true, children will be automatically
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
* and thus rendered on top of other displayObjects within the same container.
*
* @member {number}
*/
prototypeAccessors.zIndex.get = function ()
{
return this._zIndex;
};
prototypeAccessors.zIndex.set = function (value) // eslint-disable-line require-jsdoc
{
this._zIndex = value;
if (this.parent)
{
this.parent.sortDirty = true;
}
};
/**
* Indicates if the object is globally visible.
*
* @member {boolean}
* @readonly
*/
prototypeAccessors.worldVisible.get = function ()
{
var item = this;
do
{
if (!item.visible)
{
return false;
Object.defineProperty(DisplayObject.prototype, "x", {
/**
* The position of the displayObject on the x axis relative to the local coordinates of the parent.
* An alias to position.x
*
* @member {number}
*/
get: function () {
return this.position.x;
},
set: function (value) {
this.transform.position.x = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "y", {
/**
* The position of the displayObject on the y axis relative to the local coordinates of the parent.
* An alias to position.y
*
* @member {number}
*/
get: function () {
return this.position.y;
},
set: function (value) {
this.transform.position.y = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "worldTransform", {
/**
* Current transform of the object based on world (parent) factors.
*
* @member {PIXI.Matrix}
* @readonly
*/
get: function () {
return this.transform.worldTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "localTransform", {
/**
* Current transform of the object based on local factors: position, scale, other stuff.
*
* @member {PIXI.Matrix}
* @readonly
*/
get: function () {
return this.transform.localTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "position", {
/**
* The coordinate of the object relative to the local coordinates of the parent.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.position;
},
set: function (value) {
this.transform.position.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "scale", {
/**
* The scale factor of the object.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.scale;
},
set: function (value) {
this.transform.scale.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "pivot", {
/**
* The pivot point of the displayObject that it rotates around.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.pivot;
},
set: function (value) {
this.transform.pivot.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "skew", {
/**
* The skew factor for the object in radians.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.skew;
},
set: function (value) {
this.transform.skew.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "rotation", {
/**
* The rotation of the object in radians.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
get: function () {
return this.transform.rotation;
},
set: function (value) {
this.transform.rotation = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "angle", {
/**
* The angle of the object in degrees.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
get: function () {
return this.transform.rotation * RAD_TO_DEG;
},
set: function (value) {
this.transform.rotation = value * DEG_TO_RAD;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "zIndex", {
/**
* The zIndex of the displayObject.
* If a container has the sortableChildren property set to true, children will be automatically
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
* and thus rendered on top of other displayObjects within the same container.
*
* @member {number}
*/
get: function () {
return this._zIndex;
},
set: function (value) {
this._zIndex = value;
if (this.parent) {
this.parent.sortDirty = true;
}
item = item.parent;
} while (item);
return true;
};
/**
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
* {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it
* utilities shape clipping. To remove a mask, set this property to `null`.
*
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
* @example
* const graphics = new PIXI.Graphics();
* graphics.beginFill(0xFF3300);
* graphics.drawRect(50, 250, 100, 100);
* graphics.endFill();
*
* const sprite = new PIXI.Sprite(texture);
* sprite.mask = graphics;
* @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
*
* @member {PIXI.Container|PIXI.MaskData}
*/
prototypeAccessors.mask.get = function ()
{
return this._mask;
};
prototypeAccessors.mask.set = function (value) // eslint-disable-line require-jsdoc
{
if (this._mask)
{
var maskObject = this._mask.maskObject || this._mask;
maskObject.renderable = true;
maskObject.isMask = false;
}
this._mask = value;
if (this._mask)
{
var maskObject$1 = this._mask.maskObject || this._mask;
maskObject$1.renderable = false;
maskObject$1.isMask = true;
}
};
Object.defineProperties( DisplayObject.prototype, prototypeAccessors );
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "worldVisible", {
/**
* Indicates if the object is globally visible.
*
* @member {boolean}
* @readonly
*/
get: function () {
var item = this;
do {
if (!item.visible) {
return false;
}
item = item.parent;
} while (item);
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "mask", {
/**
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
* {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it
* utilities shape clipping. To remove a mask, set this property to `null`.
*
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
* @example
* const graphics = new PIXI.Graphics();
* graphics.beginFill(0xFF3300);
* graphics.drawRect(50, 250, 100, 100);
* graphics.endFill();
*
* const sprite = new PIXI.Sprite(texture);
* sprite.mask = graphics;
* @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
*
* @member {PIXI.Container|PIXI.MaskData|null}
*/
get: function () {
return this._mask;
},
set: function (value) {
if (this._mask) {
var maskObject = (this._mask.maskObject || this._mask);
maskObject.renderable = true;
maskObject.isMask = false;
}
this._mask = value;
if (this._mask) {
var maskObject = (this._mask.maskObject || this._mask);
maskObject.renderable = false;
maskObject.isMask = true;
}
},
enumerable: false,
configurable: true
});
return DisplayObject;
}(EventEmitter));
var TemporaryDisplayObject = /** @class */ (function (_super) {
__extends(TemporaryDisplayObject, _super);
function TemporaryDisplayObject() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.sortDirty = null;
return _this;
}
return TemporaryDisplayObject;
}(DisplayObject));
/**

@@ -1252,12 +1162,8 @@ * DisplayObject default updateTransform, does not update children of container.

function sortChildren(a, b)
{
if (a.zIndex === b.zIndex)
{
function sortChildren(a, b) {
if (a.zIndex === b.zIndex) {
return a._lastSortedIndex - b._lastSortedIndex;
}
return a.zIndex - b.zIndex;
}
/**

@@ -1277,7 +1183,6 @@ * A Container represents a collection of display objects.

*/
var Container = /*@__PURE__*/(function (DisplayObject) {
function Container()
{
DisplayObject.call(this);
var Container = /** @class */ (function (_super) {
__extends(Container, _super);
function Container() {
var _this = _super.call(this) || this;
/**

@@ -1289,4 +1194,3 @@ * The array of children of this container.

*/
this.children = [];
_this.children = [];
/**

@@ -1307,4 +1211,3 @@ * If set to true, the container will sort its children by zIndex value

*/
this.sortableChildren = settings.SORTABLE_CHILDREN;
_this.sortableChildren = settings.SORTABLE_CHILDREN;
/**

@@ -1316,4 +1219,4 @@ * Should children be sorted by zIndex at the next updateTransform call.

*/
this.sortDirty = false;
_this.sortDirty = false;
return _this;
/**

@@ -1327,3 +1230,2 @@ * Fired when a DisplayObject is added to this Container.

*/
/**

@@ -1338,9 +1240,2 @@ * Fired when a DisplayObject is removed from this Container.

}
if ( DisplayObject ) Container.__proto__ = DisplayObject;
Container.prototype = Object.create( DisplayObject && DisplayObject.prototype );
Container.prototype.constructor = Container;
var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };
/**

@@ -1351,7 +1246,5 @@ * Overridable method that can be used by Container subclasses whenever the children array is modified

*/
Container.prototype.onChildrenChange = function onChildrenChange ()
{
Container.prototype.onChildrenChange = function (_length) {
/* empty */
};
/**

@@ -1362,40 +1255,33 @@ * Adds one or more children to the container.

*
* @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container
* @return {PIXI.DisplayObject} The first child that was added.
*/
Container.prototype.addChild = function addChild (child)
{
Container.prototype.addChild = function () {
var arguments$1 = arguments;
var argumentsLength = arguments.length;
var children = [];
for (var _i = 0; _i < arguments.length; _i++) {
children[_i] = arguments$1[_i];
}
// if there is only one argument we can bypass looping through the them
if (argumentsLength > 1)
{
// loop through the arguments property and add all children
// use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
for (var i = 0; i < argumentsLength; i++)
{
this.addChild(arguments$1[i]);
if (children.length > 1) {
// loop through the array and add all children
for (var i = 0; i < children.length; i++) {
// eslint-disable-next-line prefer-rest-params
this.addChild(children[i]);
}
}
else
{
else {
var child = children[0];
// if the child has a parent then lets remove it as PixiJS objects can only exist in one place
if (child.parent)
{
if (child.parent) {
child.parent.removeChild(child);
}
child.parent = this;
this.sortDirty = true;
// ensure child transform will be recalculated
child.transform._parentID = -1;
this.children.push(child);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1406,6 +1292,4 @@ this.onChildrenChange(this.children.length - 1);

}
return child;
return children[0];
};
/**

@@ -1418,25 +1302,16 @@ * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown

*/
Container.prototype.addChildAt = function addChildAt (child, index)
{
if (index < 0 || index > this.children.length)
{
throw new Error((child + "addChildAt: The index " + index + " supplied is out of bounds " + (this.children.length)));
Container.prototype.addChildAt = function (child, index) {
if (index < 0 || index > this.children.length) {
throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length);
}
if (child.parent)
{
if (child.parent) {
child.parent.removeChild(child);
}
child.parent = this;
this.sortDirty = true;
// ensure child transform will be recalculated
child.transform._parentID = -1;
this.children.splice(index, 0, child);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1446,6 +1321,4 @@ this.onChildrenChange(index);

this.emit('childAdded', child, this, index);
return child;
};
/**

@@ -1457,12 +1330,8 @@ * Swaps the position of 2 Display Objects within this container.

*/
Container.prototype.swapChildren = function swapChildren (child, child2)
{
if (child === child2)
{
Container.prototype.swapChildren = function (child, child2) {
if (child === child2) {
return;
}
var index1 = this.getChildIndex(child);
var index2 = this.getChildIndex(child2);
this.children[index1] = child2;

@@ -1472,3 +1341,2 @@ this.children[index2] = child;

};
/**

@@ -1480,14 +1348,9 @@ * Returns the index position of a child DisplayObject instance

*/
Container.prototype.getChildIndex = function getChildIndex (child)
{
Container.prototype.getChildIndex = function (child) {
var index = this.children.indexOf(child);
if (index === -1)
{
if (index === -1) {
throw new Error('The supplied DisplayObject must be a child of the caller');
}
return index;
};
/**

@@ -1499,17 +1362,11 @@ * Changes the position of an existing child in the display object container

*/
Container.prototype.setChildIndex = function setChildIndex (child, index)
{
if (index < 0 || index >= this.children.length)
{
throw new Error(("The index " + index + " supplied is out of bounds " + (this.children.length)));
Container.prototype.setChildIndex = function (child, index) {
if (index < 0 || index >= this.children.length) {
throw new Error("The index " + index + " supplied is out of bounds " + this.children.length);
}
var currentIndex = this.getChildIndex(child);
removeItems(this.children, currentIndex, 1); // remove from old position
this.children.splice(index, 0, child); // add at new position
this.onChildrenChange(index);
};
/**

@@ -1521,40 +1378,33 @@ * Returns the child at the specified index

*/
Container.prototype.getChildAt = function getChildAt (index)
{
if (index < 0 || index >= this.children.length)
{
throw new Error(("getChildAt: Index (" + index + ") does not exist."));
Container.prototype.getChildAt = function (index) {
if (index < 0 || index >= this.children.length) {
throw new Error("getChildAt: Index (" + index + ") does not exist.");
}
return this.children[index];
};
/**
* Removes one or more children from the container.
*
* @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove
* @return {PIXI.DisplayObject} The first child that was removed.
*/
Container.prototype.removeChild = function removeChild (child)
{
Container.prototype.removeChild = function () {
var arguments$1 = arguments;
var argumentsLength = arguments.length;
var children = [];
for (var _i = 0; _i < arguments.length; _i++) {
children[_i] = arguments$1[_i];
}
// if there is only one argument we can bypass looping through the them
if (argumentsLength > 1)
{
// loop through the arguments property and add all children
// use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
for (var i = 0; i < argumentsLength; i++)
{
this.removeChild(arguments$1[i]);
if (children.length > 1) {
// loop through the arguments property and remove all children
for (var i = 0; i < children.length; i++) {
this.removeChild(children[i]);
}
}
else
{
else {
var child = children[0];
var index = this.children.indexOf(child);
if (index === -1) { return null; }
if (index === -1)
{ return null; }
child.parent = null;

@@ -1564,6 +1414,4 @@ // ensure child transform will be recalculated

removeItems(this.children, index, 1);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1574,6 +1422,4 @@ this.onChildrenChange(index);

}
return child;
return children[0];
};
/**

@@ -1585,6 +1431,4 @@ * Removes a child from the specified index position.

*/
Container.prototype.removeChildAt = function removeChildAt (index)
{
Container.prototype.removeChildAt = function (index) {
var child = this.getChildAt(index);
// ensure child transform will be recalculated..

@@ -1594,6 +1438,4 @@ child.parent = null;

removeItems(this.children, index, 1);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1603,6 +1445,4 @@ this.onChildrenChange(index);

this.emit('childRemoved', child, this, index);
return child;
};
/**

@@ -1615,94 +1455,61 @@ * Removes all children from this container that are within the begin and end indexes.

*/
Container.prototype.removeChildren = function removeChildren (beginIndex, endIndex)
{
if ( beginIndex === void 0 ) beginIndex = 0;
Container.prototype.removeChildren = function (beginIndex, endIndex) {
if (beginIndex === void 0) { beginIndex = 0; }
if (endIndex === void 0) { endIndex = this.children.length; }
var begin = beginIndex;
var end = typeof endIndex === 'number' ? endIndex : this.children.length;
var end = endIndex;
var range = end - begin;
var removed;
if (range > 0 && range <= end)
{
if (range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (var i = 0; i < removed.length; ++i)
{
for (var i = 0; i < removed.length; ++i) {
removed[i].parent = null;
if (removed[i].transform)
{
if (removed[i].transform) {
removed[i].transform._parentID = -1;
}
}
this._boundsID++;
this.onChildrenChange(beginIndex);
for (var i$1 = 0; i$1 < removed.length; ++i$1)
{
removed[i$1].emit('removed', this);
this.emit('childRemoved', removed[i$1], this, i$1);
for (var i = 0; i < removed.length; ++i) {
removed[i].emit('removed', this);
this.emit('childRemoved', removed[i], this, i);
}
return removed;
}
else if (range === 0 && this.children.length === 0)
{
else if (range === 0 && this.children.length === 0) {
return [];
}
throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
};
/**
* Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.
*/
Container.prototype.sortChildren = function sortChildren$1 ()
{
Container.prototype.sortChildren = function () {
var sortRequired = false;
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
child._lastSortedIndex = i;
if (!sortRequired && child.zIndex !== 0)
{
if (!sortRequired && child.zIndex !== 0) {
sortRequired = true;
}
}
if (sortRequired && this.children.length > 1)
{
if (sortRequired && this.children.length > 1) {
this.children.sort(sortChildren);
}
this.sortDirty = false;
};
/**
* Updates the transform on all children of this container for rendering
*/
Container.prototype.updateTransform = function updateTransform ()
{
if (this.sortableChildren && this.sortDirty)
{
Container.prototype.updateTransform = function () {
if (this.sortableChildren && this.sortDirty) {
this.sortChildren();
}
this._boundsID++;
this.transform.updateTransform(this.parent.transform);
// TODO: check render flags, how to process stuff here
this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
if (child.visible)
{
if (child.visible) {
child.updateTransform();

@@ -1712,3 +1519,2 @@ }

};
/**

@@ -1718,41 +1524,48 @@ * Recalculates the bounds of the container.

*/
Container.prototype.calculateBounds = function calculateBounds ()
{
Container.prototype.calculateBounds = function () {
this._bounds.clear();
this._calculateBounds();
for (var i = 0; i < this.children.length; i++)
{
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if (!child.visible || !child.renderable)
{
if (!child.visible || !child.renderable) {
continue;
}
child.calculateBounds();
// TODO: filter+mask, need to mask both somehow
if (child._mask)
{
var maskObject = child._mask.maskObject || child._mask;
if (child._mask) {
var maskObject = (child._mask.maskObject || child._mask);
maskObject.calculateBounds();
this._bounds.addBoundsMask(child._bounds, maskObject._bounds);
}
else if (child.filterArea)
{
else if (child.filterArea) {
this._bounds.addBoundsArea(child._bounds, child.filterArea);
}
else
{
else {
this._bounds.addBounds(child._bounds);
}
}
this._lastBoundsID = this._boundsID;
this._bounds.updateID = this._boundsID;
};
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
*
* @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.
* @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,
* it was default behaviour of pixi 4.0-5.2 and caused many problems to users.
* @return {PIXI.Rectangle} The rectangular bounding area.
*/
Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) {
if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; }
var result = _super.prototype.getLocalBounds.call(this, rect);
if (!skipChildrenUpdate) {
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
if (child.visible) {
child.updateTransform();
}
}
}
return result;
};
/**
* Recalculates the bounds of the object. Override this to

@@ -1763,7 +1576,5 @@ * calculate the bounds of the specific object (not including children).

*/
Container.prototype._calculateBounds = function _calculateBounds ()
{
Container.prototype._calculateBounds = function () {
// FILL IN//
};
/**

@@ -1774,22 +1585,15 @@ * Renders the object using the WebGL renderer

*/
Container.prototype.render = function render (renderer)
{
Container.prototype.render = function (renderer) {
// if the object is not visible or the alpha is 0 then no need to render this element
if (!this.visible || this.worldAlpha <= 0 || !this.renderable)
{
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
// do a quick check to see if this element has a mask or a filter.
if (this._mask || (this.filters && this.filters.length))
{
if (this._mask || (this.filters && this.filters.length)) {
this.renderAdvanced(renderer);
}
else
{
else {
this._render(renderer);
// simple render children!
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
this.children[i].render(renderer);

@@ -1799,3 +1603,2 @@ }

};
/**

@@ -1807,60 +1610,38 @@ * Render the object using the WebGL renderer and advanced features.

*/
Container.prototype.renderAdvanced = function renderAdvanced (renderer)
{
Container.prototype.renderAdvanced = function (renderer) {
renderer.batch.flush();
var filters = this.filters;
var mask = this._mask;
// push filter first as we need to ensure the stencil buffer is correct for any masking
if (filters)
{
if (!this._enabledFilters)
{
if (filters) {
if (!this._enabledFilters) {
this._enabledFilters = [];
}
this._enabledFilters.length = 0;
for (var i = 0; i < filters.length; i++)
{
if (filters[i].enabled)
{
for (var i = 0; i < filters.length; i++) {
if (filters[i].enabled) {
this._enabledFilters.push(filters[i]);
}
}
if (this._enabledFilters.length)
{
if (this._enabledFilters.length) {
renderer.filter.push(this, this._enabledFilters);
}
}
if (mask)
{
if (mask) {
renderer.mask.push(this, this._mask);
}
// add this object to the batch, only rendered if it has a texture.
this._render(renderer);
// now loop through the children and make sure they get rendered
for (var i$1 = 0, j = this.children.length; i$1 < j; i$1++)
{
this.children[i$1].render(renderer);
for (var i = 0, j = this.children.length; i < j; i++) {
this.children[i].render(renderer);
}
renderer.batch.flush();
if (mask)
{
renderer.mask.pop(this, this._mask);
if (mask) {
renderer.mask.pop(this);
}
if (filters && this._enabledFilters && this._enabledFilters.length)
{
if (filters && this._enabledFilters && this._enabledFilters.length) {
renderer.filter.pop();
}
};
/**

@@ -1872,7 +1653,5 @@ * To be overridden by the subclasses.

*/
Container.prototype._render = function _render (renderer) // eslint-disable-line no-unused-vars
{
Container.prototype._render = function (_renderer) {
// this is where content itself gets rendered...
};
/**

@@ -1891,16 +1670,9 @@ * Removes all internal references and listeners as well as removes children from the display list.

*/
Container.prototype.destroy = function destroy (options)
{
DisplayObject.prototype.destroy.call(this);
Container.prototype.destroy = function (options) {
_super.prototype.destroy.call(this);
this.sortDirty = false;
var destroyChildren = typeof options === 'boolean' ? options : options && options.children;
var oldChildren = this.removeChildren(0, this.children.length);
if (destroyChildren)
{
for (var i = 0; i < oldChildren.length; ++i)
{
if (destroyChildren) {
for (var i = 0; i < oldChildren.length; ++i) {
oldChildren[i].destroy(options);

@@ -1910,64 +1682,58 @@ }

};
/**
* The width of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
prototypeAccessors.width.get = function ()
{
return this.scale.x * this.getLocalBounds().width;
};
prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
{
var width = this.getLocalBounds().width;
if (width !== 0)
{
this.scale.x = value / width;
}
else
{
this.scale.x = 1;
}
this._width = value;
};
/**
* The height of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
prototypeAccessors.height.get = function ()
{
return this.scale.y * this.getLocalBounds().height;
};
prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
{
var height = this.getLocalBounds().height;
if (height !== 0)
{
this.scale.y = value / height;
}
else
{
this.scale.y = 1;
}
this._height = value;
};
Object.defineProperties( Container.prototype, prototypeAccessors );
Object.defineProperty(Container.prototype, "width", {
/**
* The width of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
get: function () {
return this.scale.x * this.getLocalBounds().width;
},
set: function (value) {
var width = this.getLocalBounds().width;
if (width !== 0) {
this.scale.x = value / width;
}
else {
this.scale.x = 1;
}
this._width = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Container.prototype, "height", {
/**
* The height of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
get: function () {
return this.scale.y * this.getLocalBounds().height;
},
set: function (value) {
var height = this.getLocalBounds().height;
if (height !== 0) {
this.scale.y = value / height;
}
else {
this.scale.y = 1;
}
this._height = value;
},
enumerable: false,
configurable: true
});
return Container;
}(DisplayObject));
// performance increase to avoid using call.. (10x faster)
/**
* Container default updateTransform, does update children of container.
* Will crash if there's no parent element.
*
* @memberof PIXI.Container#
* @function containerUpdateTransform
*/
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;
export { Bounds, Container, DisplayObject };
export { Bounds, Container, DisplayObject, TemporaryDisplayObject };
//# sourceMappingURL=display.es.js.map
/*!
* @pixi/display - v5.2.4
* Compiled Sun, 03 May 2020 22:38:52 UTC
* @pixi/display - v5.3.0
* Compiled Thu, 18 Jun 2020 23:27:40 UTC
*

@@ -46,228 +46,93 @@ * @pixi/display is licensed under the MIT License.

*/
var Bounds = function Bounds()
{
var Bounds = /** @class */ (function () {
function Bounds() {
/**
* @member {number}
* @default 0
*/
this.minX = Infinity;
/**
* @member {number}
* @default 0
*/
this.minY = Infinity;
/**
* @member {number}
* @default 0
*/
this.maxX = -Infinity;
/**
* @member {number}
* @default 0
*/
this.maxY = -Infinity;
this.rect = null;
/**
* It is updated to _boundsID of corresponding object to keep bounds in sync with content.
* Updated from outside, thus public modifier.
*
* @member {number}
* @public
*/
this.updateID = -1;
}
/**
* @member {number}
* @default 0
* Checks if bounds are empty.
*
* @return {boolean} True if empty.
*/
this.minX = Infinity;
Bounds.prototype.isEmpty = function () {
return this.minX > this.maxX || this.minY > this.maxY;
};
/**
* @member {number}
* @default 0
* Clears the bounds and resets.
*
*/
this.minY = Infinity;
Bounds.prototype.clear = function () {
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
};
/**
* @member {number}
* @default 0
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
*
* @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty
* @returns {PIXI.Rectangle} A rectangle of the bounds
*/
this.maxX = -Infinity;
Bounds.prototype.getRectangle = function (rect) {
if (this.minX > this.maxX || this.minY > this.maxY) {
return math.Rectangle.EMPTY;
}
rect = rect || new math.Rectangle(0, 0, 1, 1);
rect.x = this.minX;
rect.y = this.minY;
rect.width = this.maxX - this.minX;
rect.height = this.maxY - this.minY;
return rect;
};
/**
* @member {number}
* @default 0
* This function should be inlined when its possible.
*
* @param {PIXI.IPointData} point - The point to add.
*/
this.maxY = -Infinity;
this.rect = null;
};
/**
* Checks if bounds are empty.
*
* @return {boolean} True if empty.
*/
Bounds.prototype.isEmpty = function isEmpty ()
{
return this.minX > this.maxX || this.minY > this.maxY;
};
/**
* Clears the bounds and resets.
*
*/
Bounds.prototype.clear = function clear ()
{
this.minX = Infinity;
this.minY = Infinity;
this.maxX = -Infinity;
this.maxY = -Infinity;
};
/**
* Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle
* It is not guaranteed that it will return tempRect
*
* @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty
* @returns {PIXI.Rectangle} A rectangle of the bounds
*/
Bounds.prototype.getRectangle = function getRectangle (rect)
{
if (this.minX > this.maxX || this.minY > this.maxY)
{
return math.Rectangle.EMPTY;
}
rect = rect || new math.Rectangle(0, 0, 1, 1);
rect.x = this.minX;
rect.y = this.minY;
rect.width = this.maxX - this.minX;
rect.height = this.maxY - this.minY;
return rect;
};
/**
* This function should be inlined when its possible.
*
* @param {PIXI.Point} point - The point to add.
*/
Bounds.prototype.addPoint = function addPoint (point)
{
this.minX = Math.min(this.minX, point.x);
this.maxX = Math.max(this.maxX, point.x);
this.minY = Math.min(this.minY, point.y);
this.maxY = Math.max(this.maxY, point.y);
};
/**
* Adds a quad, not transformed
*
* @param {Float32Array} vertices - The verts to add.
*/
Bounds.prototype.addQuad = function addQuad (vertices)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = vertices[0];
var y = vertices[1];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[2];
y = vertices[3];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[4];
y = vertices[5];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[6];
y = vertices[7];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds sprite frame, transformed.
*
* @param {PIXI.Transform} transform - transform to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrame = function addFrame (transform, x0, y0, x1, y1)
{
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
};
/**
* Adds sprite frame, multiplied by matrix
*
* @param {PIXI.Matrix} matrix - matrix to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrameMatrix = function addFrameMatrix (matrix, x0, y0, x1, y1)
{
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = (a * x0) + (c * y0) + tx;
var y = (b * x0) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y0) + tx;
y = (b * x1) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x0) + (c * y1) + tx;
y = (b * x0) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y1) + tx;
y = (b * x1) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds screen vertices from array
*
* @param {Float32Array} vertexData - calculated vertices
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertexData = function addVertexData (vertexData, beginOffset, endOffset)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2)
{
var x = vertexData[i];
var y = vertexData[i + 1];
Bounds.prototype.addPoint = function (point) {
this.minX = Math.min(this.minX, point.x);
this.maxX = Math.max(this.maxX, point.x);
this.minY = Math.min(this.minY, point.y);
this.maxY = Math.max(this.maxY, point.y);
};
/**
* Adds a quad, not transformed
*
* @param {Float32Array} vertices - The verts to add.
*/
Bounds.prototype.addQuad = function (vertices) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
var x = vertices[0];
var y = vertices[1];
minX = x < minX ? x : minX;

@@ -277,102 +142,53 @@ minY = y < minY ? y : minY;

maxY = y > maxY ? y : maxY;
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Transform} transform - mesh transform
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertices = function addVertices (transform, vertices, beginOffset, endOffset)
{
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Matrix} matrix - mesh matrix
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
* @param {number} [padX] - x padding
* @param {number} [padY] - y padding
*/
Bounds.prototype.addVerticesMatrix = function addVerticesMatrix (matrix, vertices, beginOffset, endOffset, padX, padY)
{
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
padX = padX || 0;
padY = padY || 0;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2)
{
var rawX = vertices[i];
var rawY = vertices[i + 1];
var x = (a * rawX) + (c * rawY) + tx;
var y = (d * rawY) + (b * rawX) + ty;
minX = Math.min(minX, x - padX);
maxX = Math.max(maxX, x + padX);
minY = Math.min(minY, y - padY);
maxY = Math.max(maxY, y + padY);
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds other Bounds
*
* @param {PIXI.Bounds} bounds - TODO
*/
Bounds.prototype.addBounds = function addBounds (bounds)
{
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX;
this.minY = bounds.minY < minY ? bounds.minY : minY;
this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;
this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
};
/**
* Adds other Bounds, masked with Bounds
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Bounds} mask - TODO
*/
Bounds.prototype.addBoundsMask = function addBoundsMask (bounds, mask)
{
var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;
var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;
var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;
var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY)
{
x = vertices[2];
y = vertices[3];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[4];
y = vertices[5];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = vertices[6];
y = vertices[7];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds sprite frame, transformed.
*
* @param {PIXI.Transform} transform - transform to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrame = function (transform, x0, y0, x1, y1) {
this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);
};
/**
* Adds sprite frame, multiplied by matrix
*
* @param {PIXI.Matrix} matrix - matrix to apply
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
*/
Bounds.prototype.addFrameMatrix = function (matrix, x0, y0, x1, y1) {
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;

@@ -382,36 +198,39 @@ var minY = this.minY;

var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty
*
* @param {PIXI.Bounds} bounds other bounds
* @param {PIXI.Matrix} matrix multiplicator
*/
Bounds.prototype.addBoundsMatrix = function addBoundsMatrix (bounds, matrix)
{
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
};
/**
* Adds other Bounds, masked with Rectangle
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Rectangle} area - TODO
*/
Bounds.prototype.addBoundsArea = function addBoundsArea (bounds, area)
{
var _minX = bounds.minX > area.x ? bounds.minX : area.x;
var _minY = bounds.minY > area.y ? bounds.minY : area.y;
var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);
var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);
if (_minX <= _maxX && _minY <= _maxY)
{
var x = (a * x0) + (c * y0) + tx;
var y = (b * x0) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y0) + tx;
y = (b * x1) + (d * y0) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x0) + (c * y1) + tx;
y = (b * x0) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
x = (a * x1) + (c * y1) + tx;
y = (b * x1) + (d * y1) + ty;
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds screen vertices from array
*
* @param {Float32Array} vertexData - calculated vertices
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertexData = function (vertexData, beginOffset, endOffset) {
var minX = this.minX;

@@ -421,55 +240,200 @@ var minY = this.minY;

var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2) {
var x = vertexData[i];
var y = vertexData[i + 1];
minX = x < minX ? x : minX;
minY = y < minY ? y : minY;
maxX = x > maxX ? x : maxX;
maxY = y > maxY ? y : maxY;
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Add an array of mesh vertices
*
* @param {PIXI.Transform} transform - mesh transform
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
*/
Bounds.prototype.addVertices = function (transform, vertices, beginOffset, endOffset) {
this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);
};
/**
* Add an array of mesh vertices.
*
* @param {PIXI.Matrix} matrix - mesh matrix
* @param {Float32Array} vertices - mesh coordinates in array
* @param {number} beginOffset - begin offset
* @param {number} endOffset - end offset, excluded
* @param {number} [padX=0] - x padding
* @param {number} [padY=0] - y padding
*/
Bounds.prototype.addVerticesMatrix = function (matrix, vertices, beginOffset, endOffset, padX, padY) {
if (padX === void 0) { padX = 0; }
if (padY === void 0) { padY = padX; }
var a = matrix.a;
var b = matrix.b;
var c = matrix.c;
var d = matrix.d;
var tx = matrix.tx;
var ty = matrix.ty;
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
for (var i = beginOffset; i < endOffset; i += 2) {
var rawX = vertices[i];
var rawY = vertices[i + 1];
var x = (a * rawX) + (c * rawY) + tx;
var y = (d * rawY) + (b * rawX) + ty;
minX = Math.min(minX, x - padX);
maxX = Math.max(maxX, x + padX);
minY = Math.min(minY, y - padY);
maxY = Math.max(maxY, y + padY);
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
};
/**
* Adds other Bounds.
*
* @param {PIXI.Bounds} bounds - The Bounds to be added
*/
Bounds.prototype.addBounds = function (bounds) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = bounds.minX < minX ? bounds.minX : minX;
this.minY = bounds.minY < minY ? bounds.minY : minY;
this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;
this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;
};
/**
* Adds other Bounds, masked with Bounds.
*
* @param {PIXI.Bounds} bounds - The Bounds to be added.
* @param {PIXI.Bounds} mask - TODO
*/
Bounds.prototype.addBoundsMask = function (bounds, mask) {
var _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;
var _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;
var _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;
var _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;
if (_minX <= _maxX && _minY <= _maxY) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.
*
* @param {PIXI.Bounds} bounds - other bounds
* @param {PIXI.Matrix} matrix - multiplicator
*/
Bounds.prototype.addBoundsMatrix = function (bounds, matrix) {
this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);
};
/**
* Adds other Bounds, masked with Rectangle.
*
* @param {PIXI.Bounds} bounds - TODO
* @param {PIXI.Rectangle} area - TODO
*/
Bounds.prototype.addBoundsArea = function (bounds, area) {
var _minX = bounds.minX > area.x ? bounds.minX : area.x;
var _minY = bounds.minY > area.y ? bounds.minY : area.y;
var _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);
var _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);
if (_minX <= _maxX && _minY <= _maxY) {
var minX = this.minX;
var minY = this.minY;
var maxX = this.maxX;
var maxY = this.maxY;
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/**
* Pads bounds object, making it grow in all directions.
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
*
* @param {number} [paddingX=0] - The horizontal padding amount.
* @param {number} [paddingY=0] - The vertical padding amount.
*/
Bounds.prototype.pad = function (paddingX, paddingY) {
if (paddingX === void 0) { paddingX = 0; }
if (paddingY === void 0) { paddingY = paddingX; }
if (!this.isEmpty()) {
this.minX -= paddingX;
this.maxX += paddingX;
this.minY -= paddingY;
this.maxY += paddingY;
}
};
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
*
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
* @param {number} padX - padding X
* @param {number} padY - padding Y
*/
Bounds.prototype.addFramePad = function (x0, y0, x1, y1, padX, padY) {
x0 -= padX;
y0 -= padY;
x1 += padX;
y1 += padY;
this.minX = this.minX < x0 ? this.minX : x0;
this.maxX = this.maxX > x1 ? this.maxX : x1;
this.minY = this.minY < y0 ? this.minY : y0;
this.maxY = this.maxY > y1 ? this.maxY : y1;
};
return Bounds;
}());
this.minX = _minX < minX ? _minX : minX;
this.minY = _minY < minY ? _minY : minY;
this.maxX = _maxX > maxX ? _maxX : maxX;
this.maxY = _maxY > maxY ? _maxY : maxY;
}
};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
/**
* Pads bounds object, making it grow in all directions.
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
*
* @param {number} [paddingX=0] - The horizontal padding amount.
* @param {number} [paddingY=0] - The vertical padding amount.
*/
Bounds.prototype.pad = function pad (paddingX, paddingY)
{
paddingX = paddingX || 0;
paddingY = paddingY || ((paddingY !== 0) ? paddingX : 0);
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
if (!this.isEmpty())
{
this.minX -= paddingX;
this.maxX += paddingX;
this.minY -= paddingY;
this.maxY += paddingY;
}
};
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
/**
* Adds padded frame. (x0, y0) should be strictly less than (x1, y1)
*
* @param {number} x0 - left X of frame
* @param {number} y0 - top Y of frame
* @param {number} x1 - right X of frame
* @param {number} y1 - bottom Y of frame
* @param {number} padX - padding X
* @param {number} padY - padding Y
*/
Bounds.prototype.addFramePad = function addFramePad (x0, y0, x1, y1, padX, padY)
{
x0 -= padX;
y0 -= padY;
x1 += padX;
y1 += padY;
this.minX = this.minX < x0 ? this.minX : x0;
this.maxX = this.maxX > x1 ? this.maxX : x1;
this.minY = this.minY < y0 ? this.minY : y0;
this.maxY = this.maxY > y1 ? this.maxY : y1;
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
return extendStatics(d, b);
};
// _tempDisplayObjectParent = new DisplayObject();
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

@@ -479,3 +443,3 @@ /**

*
* This is an abstract class and should not be used on its own; rather it should be extended.
* This is an abstract class and should not be used on its own; rather it should b e extended.
*

@@ -486,9 +450,7 @@ * @class

*/
var DisplayObject = /*@__PURE__*/(function (EventEmitter) {
function DisplayObject()
{
EventEmitter.call(this);
this.tempDisplayObjectParent = null;
var DisplayObject = /** @class */ (function (_super) {
__extends(DisplayObject, _super);
function DisplayObject() {
var _this = _super.call(this) || this;
_this.tempDisplayObjectParent = null;
// TODO: need to create Transform from factory

@@ -501,4 +463,3 @@ /**

*/
this.transform = new math.Transform();
_this.transform = new math.Transform();
/**

@@ -509,4 +470,3 @@ * The opacity of the object.

*/
this.alpha = 1;
_this.alpha = 1;
/**

@@ -520,4 +480,3 @@ * The visibility of the object. If false the object will not be drawn, and

*/
this.visible = true;
_this.visible = true;
/**

@@ -531,4 +490,3 @@ * Can this object be rendered, if false the object will not be drawn but the updateTransform

*/
this.renderable = true;
_this.renderable = true;
/**

@@ -538,6 +496,4 @@ * The display object container that contains this display object.

* @member {PIXI.Container}
* @readonly
*/
this.parent = null;
_this.parent = null;
/**

@@ -549,4 +505,3 @@ * The multiplied alpha of the displayObject.

*/
this.worldAlpha = 1;
_this.worldAlpha = 1;
/**

@@ -559,4 +514,3 @@ * Which index in the children array the display component was before the previous zIndex sort.

*/
this._lastSortedIndex = 0;
_this._lastSortedIndex = 0;
/**

@@ -569,4 +523,3 @@ * The zIndex of the displayObject.

*/
this._zIndex = 0;
_this._zIndex = 0;
/**

@@ -580,4 +533,3 @@ * The area the filter is applied to. This is used as more of an optimization

*/
this.filterArea = null;
_this.filterArea = null;
/**

@@ -590,25 +542,49 @@ * Sets the filters for the displayObject.

*/
this.filters = null;
this._enabledFilters = null;
_this.filters = null;
/**
* Currently enabled filters
* @member {PIXI.Filter[]}
* @protected
*/
_this._enabledFilters = null;
/**
* The bounds object, this is used to calculate and store the bounds of the displayObject.
*
* @member {PIXI.Bounds}
*/
_this._bounds = new Bounds();
/**
* Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.
*
* @member {PIXI.Bounds}
*/
_this._localBounds = null;
/**
* Flags the cached bounds as dirty.
*
* @member {number}
* @protected
*/
this._bounds = new Bounds();
this._boundsID = 0;
this._lastBoundsID = -1;
this._boundsRect = null;
this._localBoundsRect = null;
_this._boundsID = 0;
/**
* Cache of this display-object's bounds-rectangle.
*
* @member {PIXI.Bounds}
* @protected
*/
_this._boundsRect = null;
/**
* Cache of this display-object's local-bounds rectangle.
*
* @member {PIXI.Bounds}
* @protected
*/
_this._localBoundsRect = null;
/**
* The original, cached mask of the object.
*
* @member {PIXI.Graphics|PIXI.Sprite|null}
* @member {PIXI.Container|PIXI.MaskData|null}
* @protected
*/
this._mask = null;
_this._mask = null;
/**

@@ -620,3 +596,2 @@ * Fired when this DisplayObject is added to a Container.

*/
/**

@@ -628,3 +603,2 @@ * Fired when this DisplayObject is removed from a Container.

*/
/**

@@ -636,4 +610,3 @@ * If the object has been destroyed via destroy(). If true, it should not be used.

*/
this._destroyed = false;
_this._destroyed = false;
/**

@@ -643,4 +616,3 @@ * used to fast check if a sprite is.. a sprite!

*/
this.isSprite = false;
_this.isSprite = false;
/**

@@ -650,47 +622,35 @@ * Does any other displayObject use this object as a mask?

*/
this.isMask = false;
_this.isMask = false;
return _this;
}
if ( EventEmitter ) DisplayObject.__proto__ = EventEmitter;
DisplayObject.prototype = Object.create( EventEmitter && EventEmitter.prototype );
DisplayObject.prototype.constructor = DisplayObject;
var prototypeAccessors = { _tempDisplayObjectParent: { configurable: true },x: { configurable: true },y: { configurable: true },worldTransform: { configurable: true },localTransform: { configurable: true },position: { configurable: true },scale: { configurable: true },pivot: { configurable: true },skew: { configurable: true },rotation: { configurable: true },angle: { configurable: true },zIndex: { configurable: true },worldVisible: { configurable: true },mask: { configurable: true } };
/**
* @protected
* @member {PIXI.DisplayObject}
* Mixes all enumerable properties and methods from a source object to DisplayObject.
*
* @param {object} source - The source of properties and methods to mix in.
*/
DisplayObject.mixin = function mixin (source)
{
DisplayObject.mixin = function (source) {
// in ES8/ES2017, this would be really easy:
// Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
// Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));
// get all the enumerable property keys
var keys = Object.keys(source);
// loop through properties
for (var i = 0; i < keys.length; ++i)
{
for (var i = 0; i < keys.length; ++i) {
var propertyName = keys[i];
// Set the property using the property descriptor - this works for accessors and normal value properties
Object.defineProperty(
DisplayObject.prototype,
propertyName,
Object.getOwnPropertyDescriptor(source, propertyName)
);
Object.defineProperty(DisplayObject.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
}
};
prototypeAccessors._tempDisplayObjectParent.get = function ()
{
if (this.tempDisplayObjectParent === null)
{
this.tempDisplayObjectParent = new DisplayObject();
/**
* Recursively updates transform of all objects from the root to this one
* internal function for toLocal()
*/
DisplayObject.prototype._recursivePostUpdateTransform = function () {
if (this.parent) {
this.parent._recursivePostUpdateTransform();
this.transform.updateTransform(this.parent.transform);
}
return this.tempDisplayObjectParent;
else {
this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
};
/**

@@ -701,6 +661,4 @@ * Updates the object transform for rendering.

*/
DisplayObject.prototype.updateTransform = function updateTransform ()
{
DisplayObject.prototype.updateTransform = function () {
this._boundsID++;
this.transform.updateTransform(this.parent.transform);

@@ -710,31 +668,3 @@ // multiply the alphas..

};
/**
* Recalculates the bounds of the display object.
*
* Does nothing by default and can be overwritten in a parent class.
*/
DisplayObject.prototype.calculateBounds = function calculateBounds ()
{
// OVERWRITE;
};
/**
* Recursively updates transform of all objects from the root to this one
* internal function for toLocal()
*/
DisplayObject.prototype._recursivePostUpdateTransform = function _recursivePostUpdateTransform ()
{
if (this.parent)
{
this.parent._recursivePostUpdateTransform();
this.transform.updateTransform(this.parent.transform);
}
else
{
this.transform.updateTransform(this._tempDisplayObjectParent.transform);
}
};
/**
* Retrieves the bounds of the displayObject as a rectangle object.

@@ -748,8 +678,5 @@ *

*/
DisplayObject.prototype.getBounds = function getBounds (skipUpdate, rect)
{
if (!skipUpdate)
{
if (!this.parent)
{
DisplayObject.prototype.getBounds = function (skipUpdate, rect) {
if (!skipUpdate) {
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -759,4 +686,3 @@ this.updateTransform();

}
else
{
else {
this._recursivePostUpdateTransform();

@@ -766,22 +692,14 @@ this.updateTransform();

}
if (this._boundsID !== this._lastBoundsID)
{
if (this._bounds.updateID !== this._boundsID) {
this.calculateBounds();
this._lastBoundsID = this._boundsID;
this._bounds.updateID = this._boundsID;
}
if (!rect)
{
if (!this._boundsRect)
{
if (!rect) {
if (!this._boundsRect) {
this._boundsRect = new math.Rectangle();
}
rect = this._boundsRect;
}
return this._bounds.getRectangle(rect);
};
/**

@@ -793,50 +711,43 @@ * Retrieves the local bounds of the displayObject as a rectangle object.

*/
DisplayObject.prototype.getLocalBounds = function getLocalBounds (rect)
{
DisplayObject.prototype.getLocalBounds = function (rect) {
if (!rect) {
if (!this._localBoundsRect) {
this._localBoundsRect = new math.Rectangle();
}
rect = this._localBoundsRect;
}
if (!this._localBounds) {
this._localBounds = new Bounds();
}
var transformRef = this.transform;
var parentRef = this.parent;
this.parent = null;
this.transform = this._tempDisplayObjectParent.transform;
if (!rect)
{
if (!this._localBoundsRect)
{
this._localBoundsRect = new math.Rectangle();
}
rect = this._localBoundsRect;
}
var worldBounds = this._bounds;
var worldBoundsID = this._boundsID;
this._bounds = this._localBounds;
var bounds = this.getBounds(false, rect);
this.parent = parentRef;
this.transform = transformRef;
this._bounds = worldBounds;
this._bounds.updateID += this._boundsID - worldBoundsID; // reflect side-effects
return bounds;
};
/**
* Calculates the global position of the display object.
*
* @param {PIXI.IPoint} position - The world origin to calculate from.
* @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
* @param {PIXI.IPointData} position - The world origin to calculate from.
* @param {PIXI.Point} [point] - A Point object in which to store the value, optional
* (otherwise will create a new Point).
* @param {boolean} [skipUpdate=false] - Should we skip the update transform.
* @return {PIXI.IPoint} A point object representing the position of this object.
* @return {PIXI.Point} A point object representing the position of this object.
*/
DisplayObject.prototype.toGlobal = function toGlobal (position, point, skipUpdate)
{
if ( skipUpdate === void 0 ) skipUpdate = false;
if (!skipUpdate)
{
DisplayObject.prototype.toGlobal = function (position, point, skipUpdate) {
if (skipUpdate === void 0) { skipUpdate = false; }
if (!skipUpdate) {
this._recursivePostUpdateTransform();
// this parent check is for just in case the item is a root object.
// If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
// this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
if (!this.parent)
{
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -846,38 +757,29 @@ this.displayObjectUpdateTransform();

}
else
{
else {
this.displayObjectUpdateTransform();
}
}
// don't need to update the lot
return this.worldTransform.apply(position, point);
};
/**
* Calculates the local position of the display object relative to another point.
*
* @param {PIXI.IPoint} position - The world origin to calculate from.
* @param {PIXI.IPointData} position - The world origin to calculate from.
* @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.
* @param {PIXI.IPoint} [point] - A Point object in which to store the value, optional
* @param {PIXI.Point} [point] - A Point object in which to store the value, optional
* (otherwise will create a new Point).
* @param {boolean} [skipUpdate=false] - Should we skip the update transform
* @return {PIXI.IPoint} A point object representing the position of this object
* @return {PIXI.Point} A point object representing the position of this object
*/
DisplayObject.prototype.toLocal = function toLocal (position, from, point, skipUpdate)
{
if (from)
{
DisplayObject.prototype.toLocal = function (position, from, point, skipUpdate) {
if (from) {
position = from.toGlobal(position, point, skipUpdate);
}
if (!skipUpdate)
{
if (!skipUpdate) {
this._recursivePostUpdateTransform();
// this parent check is for just in case the item is a root object.
// If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly
// this is mainly to avoid a parent check in the main loop. Every little helps for performance :)
if (!this.parent)
{
if (!this.parent) {
this.parent = this._tempDisplayObjectParent;

@@ -887,23 +789,10 @@ this.displayObjectUpdateTransform();

}
else
{
else {
this.displayObjectUpdateTransform();
}
}
// simply apply the matrix..
return this.worldTransform.applyInverse(position, point);
};
/**
* Renders the object using the WebGL renderer.
*
* @param {PIXI.Renderer} renderer - The renderer.
*/
DisplayObject.prototype.render = function render (renderer) // eslint-disable-line no-unused-vars
{
// OVERWRITE;
};
/**
* Set the parent Container of this DisplayObject.

@@ -914,14 +803,9 @@ *

*/
DisplayObject.prototype.setParent = function setParent (container)
{
if (!container || !container.addChild)
{
DisplayObject.prototype.setParent = function (container) {
if (!container || !container.addChild) {
throw new Error('setParent: Argument must be a Container');
}
container.addChild(this);
return container;
};
/**

@@ -941,14 +825,12 @@ * Convenience function to set the position, scale, skew and pivot at once.

*/
DisplayObject.prototype.setTransform = function setTransform (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY)
{
if ( x === void 0 ) x = 0;
if ( y === void 0 ) y = 0;
if ( scaleX === void 0 ) scaleX = 1;
if ( scaleY === void 0 ) scaleY = 1;
if ( rotation === void 0 ) rotation = 0;
if ( skewX === void 0 ) skewX = 0;
if ( skewY === void 0 ) skewY = 0;
if ( pivotX === void 0 ) pivotX = 0;
if ( pivotY === void 0 ) pivotY = 0;
DisplayObject.prototype.setTransform = function (x, y, scaleX, scaleY, rotation, skewX, skewY, pivotX, pivotY) {
if (x === void 0) { x = 0; }
if (y === void 0) { y = 0; }
if (scaleX === void 0) { scaleX = 1; }
if (scaleY === void 0) { scaleY = 1; }
if (rotation === void 0) { rotation = 0; }
if (skewX === void 0) { skewX = 0; }
if (skewY === void 0) { skewY = 0; }
if (pivotX === void 0) { pivotX = 0; }
if (pivotY === void 0) { pivotY = 0; }
this.position.x = x;

@@ -963,6 +845,4 @@ this.position.y = y;

this.pivot.y = pivotY;
return this;
};
/**

@@ -975,6 +855,4 @@ * Base destroy method for generic display objects. This will automatically

*/
DisplayObject.prototype.destroy = function destroy ()
{
if (this.parent)
{
DisplayObject.prototype.destroy = function (_options) {
if (this.parent) {
this.parent.removeChild(this);

@@ -984,263 +862,295 @@ }

this.transform = null;
this.parent = null;
this._bounds = null;
this._currentBounds = null;
this._mask = null;
this.filters = null;
this.filterArea = null;
this.hitArea = null;
this.interactive = false;
this.interactiveChildren = false;
this._destroyed = true;
};
Object.defineProperty(DisplayObject.prototype, "_tempDisplayObjectParent", {
/**
* @protected
* @member {PIXI.Container}
*/
get: function () {
if (this.tempDisplayObjectParent === null) {
// eslint-disable-next-line no-use-before-define
this.tempDisplayObjectParent = new TemporaryDisplayObject();
}
return this.tempDisplayObjectParent;
},
enumerable: false,
configurable: true
});
/**
* The position of the displayObject on the x axis relative to the local coordinates of the parent.
* An alias to position.x
* Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root
*
* @member {number}
*/
prototypeAccessors.x.get = function ()
{
return this.position.x;
};
prototypeAccessors.x.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.x = value;
};
/**
* The position of the displayObject on the y axis relative to the local coordinates of the parent.
* An alias to position.y
* ```
* const cacheParent = elem.enableTempParent();
* elem.updateTransform();
* elem.disableTempParent(cacheParent);
* ```
*
* @member {number}
* @returns {PIXI.DisplayObject} current parent
*/
prototypeAccessors.y.get = function ()
{
return this.position.y;
DisplayObject.prototype.enableTempParent = function () {
var myParent = this.parent;
this.parent = this._tempDisplayObjectParent;
return myParent;
};
prototypeAccessors.y.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.y = value;
};
/**
* Current transform of the object based on world (parent) factors.
*
* @member {PIXI.Matrix}
* @readonly
* Pair method for `enableTempParent`
* @param {PIXI.DisplayObject} cacheParent actual parent of element
*/
prototypeAccessors.worldTransform.get = function ()
{
return this.transform.worldTransform;
DisplayObject.prototype.disableTempParent = function (cacheParent) {
this.parent = cacheParent;
};
/**
* Current transform of the object based on local factors: position, scale, other stuff.
*
* @member {PIXI.Matrix}
* @readonly
*/
prototypeAccessors.localTransform.get = function ()
{
return this.transform.localTransform;
};
/**
* The coordinate of the object relative to the local coordinates of the parent.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.position.get = function ()
{
return this.transform.position;
};
prototypeAccessors.position.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.position.copyFrom(value);
};
/**
* The scale factor of the object.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.scale.get = function ()
{
return this.transform.scale;
};
prototypeAccessors.scale.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.scale.copyFrom(value);
};
/**
* The pivot point of the displayObject that it rotates around.
* Assignment by value since pixi-v4.
*
* @member {PIXI.IPoint}
*/
prototypeAccessors.pivot.get = function ()
{
return this.transform.pivot;
};
prototypeAccessors.pivot.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.pivot.copyFrom(value);
};
/**
* The skew factor for the object in radians.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
prototypeAccessors.skew.get = function ()
{
return this.transform.skew;
};
prototypeAccessors.skew.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.skew.copyFrom(value);
};
/**
* The rotation of the object in radians.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
prototypeAccessors.rotation.get = function ()
{
return this.transform.rotation;
};
prototypeAccessors.rotation.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.rotation = value;
};
/**
* The angle of the object in degrees.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
prototypeAccessors.angle.get = function ()
{
return this.transform.rotation * math.RAD_TO_DEG;
};
prototypeAccessors.angle.set = function (value) // eslint-disable-line require-jsdoc
{
this.transform.rotation = value * math.DEG_TO_RAD;
};
/**
* The zIndex of the displayObject.
* If a container has the sortableChildren property set to true, children will be automatically
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
* and thus rendered on top of other displayObjects within the same container.
*
* @member {number}
*/
prototypeAccessors.zIndex.get = function ()
{
return this._zIndex;
};
prototypeAccessors.zIndex.set = function (value) // eslint-disable-line require-jsdoc
{
this._zIndex = value;
if (this.parent)
{
this.parent.sortDirty = true;
}
};
/**
* Indicates if the object is globally visible.
*
* @member {boolean}
* @readonly
*/
prototypeAccessors.worldVisible.get = function ()
{
var item = this;
do
{
if (!item.visible)
{
return false;
Object.defineProperty(DisplayObject.prototype, "x", {
/**
* The position of the displayObject on the x axis relative to the local coordinates of the parent.
* An alias to position.x
*
* @member {number}
*/
get: function () {
return this.position.x;
},
set: function (value) {
this.transform.position.x = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "y", {
/**
* The position of the displayObject on the y axis relative to the local coordinates of the parent.
* An alias to position.y
*
* @member {number}
*/
get: function () {
return this.position.y;
},
set: function (value) {
this.transform.position.y = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "worldTransform", {
/**
* Current transform of the object based on world (parent) factors.
*
* @member {PIXI.Matrix}
* @readonly
*/
get: function () {
return this.transform.worldTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "localTransform", {
/**
* Current transform of the object based on local factors: position, scale, other stuff.
*
* @member {PIXI.Matrix}
* @readonly
*/
get: function () {
return this.transform.localTransform;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "position", {
/**
* The coordinate of the object relative to the local coordinates of the parent.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.position;
},
set: function (value) {
this.transform.position.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "scale", {
/**
* The scale factor of the object.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.scale;
},
set: function (value) {
this.transform.scale.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "pivot", {
/**
* The pivot point of the displayObject that it rotates around.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.pivot;
},
set: function (value) {
this.transform.pivot.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "skew", {
/**
* The skew factor for the object in radians.
* Assignment by value since pixi-v4.
*
* @member {PIXI.ObservablePoint}
*/
get: function () {
return this.transform.skew;
},
set: function (value) {
this.transform.skew.copyFrom(value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "rotation", {
/**
* The rotation of the object in radians.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
get: function () {
return this.transform.rotation;
},
set: function (value) {
this.transform.rotation = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "angle", {
/**
* The angle of the object in degrees.
* 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.
*
* @member {number}
*/
get: function () {
return this.transform.rotation * math.RAD_TO_DEG;
},
set: function (value) {
this.transform.rotation = value * math.DEG_TO_RAD;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "zIndex", {
/**
* The zIndex of the displayObject.
* If a container has the sortableChildren property set to true, children will be automatically
* sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,
* and thus rendered on top of other displayObjects within the same container.
*
* @member {number}
*/
get: function () {
return this._zIndex;
},
set: function (value) {
this._zIndex = value;
if (this.parent) {
this.parent.sortDirty = true;
}
item = item.parent;
} while (item);
return true;
};
/**
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
* {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it
* utilities shape clipping. To remove a mask, set this property to `null`.
*
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
* @example
* const graphics = new PIXI.Graphics();
* graphics.beginFill(0xFF3300);
* graphics.drawRect(50, 250, 100, 100);
* graphics.endFill();
*
* const sprite = new PIXI.Sprite(texture);
* sprite.mask = graphics;
* @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
*
* @member {PIXI.Container|PIXI.MaskData}
*/
prototypeAccessors.mask.get = function ()
{
return this._mask;
};
prototypeAccessors.mask.set = function (value) // eslint-disable-line require-jsdoc
{
if (this._mask)
{
var maskObject = this._mask.maskObject || this._mask;
maskObject.renderable = true;
maskObject.isMask = false;
}
this._mask = value;
if (this._mask)
{
var maskObject$1 = this._mask.maskObject || this._mask;
maskObject$1.renderable = false;
maskObject$1.isMask = true;
}
};
Object.defineProperties( DisplayObject.prototype, prototypeAccessors );
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "worldVisible", {
/**
* Indicates if the object is globally visible.
*
* @member {boolean}
* @readonly
*/
get: function () {
var item = this;
do {
if (!item.visible) {
return false;
}
item = item.parent;
} while (item);
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(DisplayObject.prototype, "mask", {
/**
* Sets a mask for the displayObject. A mask is an object that limits the visibility of an
* object to the shape of the mask applied to it. In PixiJS a regular mask must be a
* {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it
* utilities shape clipping. To remove a mask, set this property to `null`.
*
* For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.
* @example
* const graphics = new PIXI.Graphics();
* graphics.beginFill(0xFF3300);
* graphics.drawRect(50, 250, 100, 100);
* graphics.endFill();
*
* const sprite = new PIXI.Sprite(texture);
* sprite.mask = graphics;
* @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.
*
* @member {PIXI.Container|PIXI.MaskData|null}
*/
get: function () {
return this._mask;
},
set: function (value) {
if (this._mask) {
var maskObject = (this._mask.maskObject || this._mask);
maskObject.renderable = true;
maskObject.isMask = false;
}
this._mask = value;
if (this._mask) {
var maskObject = (this._mask.maskObject || this._mask);
maskObject.renderable = false;
maskObject.isMask = true;
}
},
enumerable: false,
configurable: true
});
return DisplayObject;
}(utils.EventEmitter));
var TemporaryDisplayObject = /** @class */ (function (_super) {
__extends(TemporaryDisplayObject, _super);
function TemporaryDisplayObject() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.sortDirty = null;
return _this;
}
return TemporaryDisplayObject;
}(DisplayObject));
/**

@@ -1255,12 +1165,8 @@ * DisplayObject default updateTransform, does not update children of container.

function sortChildren(a, b)
{
if (a.zIndex === b.zIndex)
{
function sortChildren(a, b) {
if (a.zIndex === b.zIndex) {
return a._lastSortedIndex - b._lastSortedIndex;
}
return a.zIndex - b.zIndex;
}
/**

@@ -1280,7 +1186,6 @@ * A Container represents a collection of display objects.

*/
var Container = /*@__PURE__*/(function (DisplayObject) {
function Container()
{
DisplayObject.call(this);
var Container = /** @class */ (function (_super) {
__extends(Container, _super);
function Container() {
var _this = _super.call(this) || this;
/**

@@ -1292,4 +1197,3 @@ * The array of children of this container.

*/
this.children = [];
_this.children = [];
/**

@@ -1310,4 +1214,3 @@ * If set to true, the container will sort its children by zIndex value

*/
this.sortableChildren = settings.settings.SORTABLE_CHILDREN;
_this.sortableChildren = settings.settings.SORTABLE_CHILDREN;
/**

@@ -1319,4 +1222,4 @@ * Should children be sorted by zIndex at the next updateTransform call.

*/
this.sortDirty = false;
_this.sortDirty = false;
return _this;
/**

@@ -1330,3 +1233,2 @@ * Fired when a DisplayObject is added to this Container.

*/
/**

@@ -1341,9 +1243,2 @@ * Fired when a DisplayObject is removed from this Container.

}
if ( DisplayObject ) Container.__proto__ = DisplayObject;
Container.prototype = Object.create( DisplayObject && DisplayObject.prototype );
Container.prototype.constructor = Container;
var prototypeAccessors = { width: { configurable: true },height: { configurable: true } };
/**

@@ -1354,7 +1249,5 @@ * Overridable method that can be used by Container subclasses whenever the children array is modified

*/
Container.prototype.onChildrenChange = function onChildrenChange ()
{
Container.prototype.onChildrenChange = function (_length) {
/* empty */
};
/**

@@ -1365,40 +1258,33 @@ * Adds one or more children to the container.

*
* @param {...PIXI.DisplayObject} child - The DisplayObject(s) to add to the container
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container
* @return {PIXI.DisplayObject} The first child that was added.
*/
Container.prototype.addChild = function addChild (child)
{
Container.prototype.addChild = function () {
var arguments$1 = arguments;
var argumentsLength = arguments.length;
var children = [];
for (var _i = 0; _i < arguments.length; _i++) {
children[_i] = arguments$1[_i];
}
// if there is only one argument we can bypass looping through the them
if (argumentsLength > 1)
{
// loop through the arguments property and add all children
// use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
for (var i = 0; i < argumentsLength; i++)
{
this.addChild(arguments$1[i]);
if (children.length > 1) {
// loop through the array and add all children
for (var i = 0; i < children.length; i++) {
// eslint-disable-next-line prefer-rest-params
this.addChild(children[i]);
}
}
else
{
else {
var child = children[0];
// if the child has a parent then lets remove it as PixiJS objects can only exist in one place
if (child.parent)
{
if (child.parent) {
child.parent.removeChild(child);
}
child.parent = this;
this.sortDirty = true;
// ensure child transform will be recalculated
child.transform._parentID = -1;
this.children.push(child);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1409,6 +1295,4 @@ this.onChildrenChange(this.children.length - 1);

}
return child;
return children[0];
};
/**

@@ -1421,25 +1305,16 @@ * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown

*/
Container.prototype.addChildAt = function addChildAt (child, index)
{
if (index < 0 || index > this.children.length)
{
throw new Error((child + "addChildAt: The index " + index + " supplied is out of bounds " + (this.children.length)));
Container.prototype.addChildAt = function (child, index) {
if (index < 0 || index > this.children.length) {
throw new Error(child + "addChildAt: The index " + index + " supplied is out of bounds " + this.children.length);
}
if (child.parent)
{
if (child.parent) {
child.parent.removeChild(child);
}
child.parent = this;
this.sortDirty = true;
// ensure child transform will be recalculated
child.transform._parentID = -1;
this.children.splice(index, 0, child);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1449,6 +1324,4 @@ this.onChildrenChange(index);

this.emit('childAdded', child, this, index);
return child;
};
/**

@@ -1460,12 +1333,8 @@ * Swaps the position of 2 Display Objects within this container.

*/
Container.prototype.swapChildren = function swapChildren (child, child2)
{
if (child === child2)
{
Container.prototype.swapChildren = function (child, child2) {
if (child === child2) {
return;
}
var index1 = this.getChildIndex(child);
var index2 = this.getChildIndex(child2);
this.children[index1] = child2;

@@ -1475,3 +1344,2 @@ this.children[index2] = child;

};
/**

@@ -1483,14 +1351,9 @@ * Returns the index position of a child DisplayObject instance

*/
Container.prototype.getChildIndex = function getChildIndex (child)
{
Container.prototype.getChildIndex = function (child) {
var index = this.children.indexOf(child);
if (index === -1)
{
if (index === -1) {
throw new Error('The supplied DisplayObject must be a child of the caller');
}
return index;
};
/**

@@ -1502,17 +1365,11 @@ * Changes the position of an existing child in the display object container

*/
Container.prototype.setChildIndex = function setChildIndex (child, index)
{
if (index < 0 || index >= this.children.length)
{
throw new Error(("The index " + index + " supplied is out of bounds " + (this.children.length)));
Container.prototype.setChildIndex = function (child, index) {
if (index < 0 || index >= this.children.length) {
throw new Error("The index " + index + " supplied is out of bounds " + this.children.length);
}
var currentIndex = this.getChildIndex(child);
utils.removeItems(this.children, currentIndex, 1); // remove from old position
this.children.splice(index, 0, child); // add at new position
this.onChildrenChange(index);
};
/**

@@ -1524,40 +1381,33 @@ * Returns the child at the specified index

*/
Container.prototype.getChildAt = function getChildAt (index)
{
if (index < 0 || index >= this.children.length)
{
throw new Error(("getChildAt: Index (" + index + ") does not exist."));
Container.prototype.getChildAt = function (index) {
if (index < 0 || index >= this.children.length) {
throw new Error("getChildAt: Index (" + index + ") does not exist.");
}
return this.children[index];
};
/**
* Removes one or more children from the container.
*
* @param {...PIXI.DisplayObject} child - The DisplayObject(s) to remove
* @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove
* @return {PIXI.DisplayObject} The first child that was removed.
*/
Container.prototype.removeChild = function removeChild (child)
{
Container.prototype.removeChild = function () {
var arguments$1 = arguments;
var argumentsLength = arguments.length;
var children = [];
for (var _i = 0; _i < arguments.length; _i++) {
children[_i] = arguments$1[_i];
}
// if there is only one argument we can bypass looping through the them
if (argumentsLength > 1)
{
// loop through the arguments property and add all children
// use it the right way (.length and [i]) so that this function can still be optimized by JS runtimes
for (var i = 0; i < argumentsLength; i++)
{
this.removeChild(arguments$1[i]);
if (children.length > 1) {
// loop through the arguments property and remove all children
for (var i = 0; i < children.length; i++) {
this.removeChild(children[i]);
}
}
else
{
else {
var child = children[0];
var index = this.children.indexOf(child);
if (index === -1) { return null; }
if (index === -1)
{ return null; }
child.parent = null;

@@ -1567,6 +1417,4 @@ // ensure child transform will be recalculated

utils.removeItems(this.children, index, 1);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1577,6 +1425,4 @@ this.onChildrenChange(index);

}
return child;
return children[0];
};
/**

@@ -1588,6 +1434,4 @@ * Removes a child from the specified index position.

*/
Container.prototype.removeChildAt = function removeChildAt (index)
{
Container.prototype.removeChildAt = function (index) {
var child = this.getChildAt(index);
// ensure child transform will be recalculated..

@@ -1597,6 +1441,4 @@ child.parent = null;

utils.removeItems(this.children, index, 1);
// ensure bounds will be recalculated
this._boundsID++;
// TODO - lets either do all callbacks or all events.. not both!

@@ -1606,6 +1448,4 @@ this.onChildrenChange(index);

this.emit('childRemoved', child, this, index);
return child;
};
/**

@@ -1618,94 +1458,61 @@ * Removes all children from this container that are within the begin and end indexes.

*/
Container.prototype.removeChildren = function removeChildren (beginIndex, endIndex)
{
if ( beginIndex === void 0 ) beginIndex = 0;
Container.prototype.removeChildren = function (beginIndex, endIndex) {
if (beginIndex === void 0) { beginIndex = 0; }
if (endIndex === void 0) { endIndex = this.children.length; }
var begin = beginIndex;
var end = typeof endIndex === 'number' ? endIndex : this.children.length;
var end = endIndex;
var range = end - begin;
var removed;
if (range > 0 && range <= end)
{
if (range > 0 && range <= end) {
removed = this.children.splice(begin, range);
for (var i = 0; i < removed.length; ++i)
{
for (var i = 0; i < removed.length; ++i) {
removed[i].parent = null;
if (removed[i].transform)
{
if (removed[i].transform) {
removed[i].transform._parentID = -1;
}
}
this._boundsID++;
this.onChildrenChange(beginIndex);
for (var i$1 = 0; i$1 < removed.length; ++i$1)
{
removed[i$1].emit('removed', this);
this.emit('childRemoved', removed[i$1], this, i$1);
for (var i = 0; i < removed.length; ++i) {
removed[i].emit('removed', this);
this.emit('childRemoved', removed[i], this, i);
}
return removed;
}
else if (range === 0 && this.children.length === 0)
{
else if (range === 0 && this.children.length === 0) {
return [];
}
throw new RangeError('removeChildren: numeric values are outside the acceptable range.');
};
/**
* Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.
*/
Container.prototype.sortChildren = function sortChildren$1 ()
{
Container.prototype.sortChildren = function () {
var sortRequired = false;
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
child._lastSortedIndex = i;
if (!sortRequired && child.zIndex !== 0)
{
if (!sortRequired && child.zIndex !== 0) {
sortRequired = true;
}
}
if (sortRequired && this.children.length > 1)
{
if (sortRequired && this.children.length > 1) {
this.children.sort(sortChildren);
}
this.sortDirty = false;
};
/**
* Updates the transform on all children of this container for rendering
*/
Container.prototype.updateTransform = function updateTransform ()
{
if (this.sortableChildren && this.sortDirty)
{
Container.prototype.updateTransform = function () {
if (this.sortableChildren && this.sortDirty) {
this.sortChildren();
}
this._boundsID++;
this.transform.updateTransform(this.parent.transform);
// TODO: check render flags, how to process stuff here
this.worldAlpha = this.alpha * this.parent.worldAlpha;
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
if (child.visible)
{
if (child.visible) {
child.updateTransform();

@@ -1715,3 +1522,2 @@ }

};
/**

@@ -1721,41 +1527,48 @@ * Recalculates the bounds of the container.

*/
Container.prototype.calculateBounds = function calculateBounds ()
{
Container.prototype.calculateBounds = function () {
this._bounds.clear();
this._calculateBounds();
for (var i = 0; i < this.children.length; i++)
{
for (var i = 0; i < this.children.length; i++) {
var child = this.children[i];
if (!child.visible || !child.renderable)
{
if (!child.visible || !child.renderable) {
continue;
}
child.calculateBounds();
// TODO: filter+mask, need to mask both somehow
if (child._mask)
{
var maskObject = child._mask.maskObject || child._mask;
if (child._mask) {
var maskObject = (child._mask.maskObject || child._mask);
maskObject.calculateBounds();
this._bounds.addBoundsMask(child._bounds, maskObject._bounds);
}
else if (child.filterArea)
{
else if (child.filterArea) {
this._bounds.addBoundsArea(child._bounds, child.filterArea);
}
else
{
else {
this._bounds.addBounds(child._bounds);
}
}
this._lastBoundsID = this._boundsID;
this._bounds.updateID = this._boundsID;
};
/**
* Retrieves the local bounds of the displayObject as a rectangle object.
*
* @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.
* @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,
* it was default behaviour of pixi 4.0-5.2 and caused many problems to users.
* @return {PIXI.Rectangle} The rectangular bounding area.
*/
Container.prototype.getLocalBounds = function (rect, skipChildrenUpdate) {
if (skipChildrenUpdate === void 0) { skipChildrenUpdate = false; }
var result = _super.prototype.getLocalBounds.call(this, rect);
if (!skipChildrenUpdate) {
for (var i = 0, j = this.children.length; i < j; ++i) {
var child = this.children[i];
if (child.visible) {
child.updateTransform();
}
}
}
return result;
};
/**
* Recalculates the bounds of the object. Override this to

@@ -1766,7 +1579,5 @@ * calculate the bounds of the specific object (not including children).

*/
Container.prototype._calculateBounds = function _calculateBounds ()
{
Container.prototype._calculateBounds = function () {
// FILL IN//
};
/**

@@ -1777,22 +1588,15 @@ * Renders the object using the WebGL renderer

*/
Container.prototype.render = function render (renderer)
{
Container.prototype.render = function (renderer) {
// if the object is not visible or the alpha is 0 then no need to render this element
if (!this.visible || this.worldAlpha <= 0 || !this.renderable)
{
if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {
return;
}
// do a quick check to see if this element has a mask or a filter.
if (this._mask || (this.filters && this.filters.length))
{
if (this._mask || (this.filters && this.filters.length)) {
this.renderAdvanced(renderer);
}
else
{
else {
this._render(renderer);
// simple render children!
for (var i = 0, j = this.children.length; i < j; ++i)
{
for (var i = 0, j = this.children.length; i < j; ++i) {
this.children[i].render(renderer);

@@ -1802,3 +1606,2 @@ }

};
/**

@@ -1810,60 +1613,38 @@ * Render the object using the WebGL renderer and advanced features.

*/
Container.prototype.renderAdvanced = function renderAdvanced (renderer)
{
Container.prototype.renderAdvanced = function (renderer) {
renderer.batch.flush();
var filters = this.filters;
var mask = this._mask;
// push filter first as we need to ensure the stencil buffer is correct for any masking
if (filters)
{
if (!this._enabledFilters)
{
if (filters) {
if (!this._enabledFilters) {
this._enabledFilters = [];
}
this._enabledFilters.length = 0;
for (var i = 0; i < filters.length; i++)
{
if (filters[i].enabled)
{
for (var i = 0; i < filters.length; i++) {
if (filters[i].enabled) {
this._enabledFilters.push(filters[i]);
}
}
if (this._enabledFilters.length)
{
if (this._enabledFilters.length) {
renderer.filter.push(this, this._enabledFilters);
}
}
if (mask)
{
if (mask) {
renderer.mask.push(this, this._mask);
}
// add this object to the batch, only rendered if it has a texture.
this._render(renderer);
// now loop through the children and make sure they get rendered
for (var i$1 = 0, j = this.children.length; i$1 < j; i$1++)
{
this.children[i$1].render(renderer);
for (var i = 0, j = this.children.length; i < j; i++) {
this.children[i].render(renderer);
}
renderer.batch.flush();
if (mask)
{
renderer.mask.pop(this, this._mask);
if (mask) {
renderer.mask.pop(this);
}
if (filters && this._enabledFilters && this._enabledFilters.length)
{
if (filters && this._enabledFilters && this._enabledFilters.length) {
renderer.filter.pop();
}
};
/**

@@ -1875,7 +1656,5 @@ * To be overridden by the subclasses.

*/
Container.prototype._render = function _render (renderer) // eslint-disable-line no-unused-vars
{
Container.prototype._render = function (_renderer) {
// this is where content itself gets rendered...
};
/**

@@ -1894,16 +1673,9 @@ * Removes all internal references and listeners as well as removes children from the display list.

*/
Container.prototype.destroy = function destroy (options)
{
DisplayObject.prototype.destroy.call(this);
Container.prototype.destroy = function (options) {
_super.prototype.destroy.call(this);
this.sortDirty = false;
var destroyChildren = typeof options === 'boolean' ? options : options && options.children;
var oldChildren = this.removeChildren(0, this.children.length);
if (destroyChildren)
{
for (var i = 0; i < oldChildren.length; ++i)
{
if (destroyChildren) {
for (var i = 0; i < oldChildren.length; ++i) {
oldChildren[i].destroy(options);

@@ -1913,61 +1685,55 @@ }

};
/**
* The width of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
prototypeAccessors.width.get = function ()
{
return this.scale.x * this.getLocalBounds().width;
};
prototypeAccessors.width.set = function (value) // eslint-disable-line require-jsdoc
{
var width = this.getLocalBounds().width;
if (width !== 0)
{
this.scale.x = value / width;
}
else
{
this.scale.x = 1;
}
this._width = value;
};
/**
* The height of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
prototypeAccessors.height.get = function ()
{
return this.scale.y * this.getLocalBounds().height;
};
prototypeAccessors.height.set = function (value) // eslint-disable-line require-jsdoc
{
var height = this.getLocalBounds().height;
if (height !== 0)
{
this.scale.y = value / height;
}
else
{
this.scale.y = 1;
}
this._height = value;
};
Object.defineProperties( Container.prototype, prototypeAccessors );
Object.defineProperty(Container.prototype, "width", {
/**
* The width of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
get: function () {
return this.scale.x * this.getLocalBounds().width;
},
set: function (value) {
var width = this.getLocalBounds().width;
if (width !== 0) {
this.scale.x = value / width;
}
else {
this.scale.x = 1;
}
this._width = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Container.prototype, "height", {
/**
* The height of the Container, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
get: function () {
return this.scale.y * this.getLocalBounds().height;
},
set: function (value) {
var height = this.getLocalBounds().height;
if (height !== 0) {
this.scale.y = value / height;
}
else {
this.scale.y = 1;
}
this._height = value;
},
enumerable: false,
configurable: true
});
return Container;
}(DisplayObject));
// performance increase to avoid using call.. (10x faster)
/**
* Container default updateTransform, does update children of container.
* Will crash if there's no parent element.
*
* @memberof PIXI.Container#
* @function containerUpdateTransform
*/
Container.prototype.containerUpdateTransform = Container.prototype.updateTransform;

@@ -1978,2 +1744,3 @@

exports.DisplayObject = DisplayObject;
exports.TemporaryDisplayObject = TemporaryDisplayObject;
//# sourceMappingURL=display.js.map
{
"name": "@pixi/display",
"version": "5.2.4",
"version": "5.3.0",
"main": "lib/display.js",

@@ -27,7 +27,7 @@ "module": "lib/display.es.js",

"dependencies": {
"@pixi/math": "5.2.4",
"@pixi/settings": "5.2.4",
"@pixi/utils": "5.2.4"
"@pixi/math": "5.3.0",
"@pixi/settings": "5.3.0",
"@pixi/utils": "5.3.0"
},
"gitHead": "71c6b3b2061af4a4f3a95a265d46e933b8befc2c"
"gitHead": "a9b7b32a9c0aeb3d9c42ef04b2c2a39be1cd0880"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc