Socket
Socket
Sign inDemoInstall

@pixi/display

Package Overview
Dependencies
Maintainers
3
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 7.0.0-beta.2 to 7.0.0-beta.3

11

dist/cjs/display.js
/*!
* @pixi/display - v7.0.0-beta.2
* Compiled Tue, 11 Oct 2022 20:10:42 UTC
* @pixi/display - v7.0.0-beta.3
* Compiled Thu, 13 Oct 2022 15:35:43 UTC
*

@@ -383,2 +383,5 @@ * @pixi/display is licensed under the MIT License.

}
removeFromParent() {
this.parent?.removeChild(this);
}
setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0) {

@@ -397,5 +400,3 @@ this.position.x = x;

destroy(_options) {
if (this.parent) {
this.parent.removeChild(this);
}
this.removeFromParent();
this._destroyed = true;

@@ -402,0 +403,0 @@ this.transform = null;

"use strict";/*!
* @pixi/display - v7.0.0-beta.2
* Compiled Tue, 11 Oct 2022 20:10:42 UTC
* @pixi/display - v7.0.0-beta.3
* Compiled Thu, 13 Oct 2022 15:35:43 UTC
*
* @pixi/display is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/Object.defineProperty(exports,"__esModule",{value:!0});var x=require("@pixi/core");x.settings.SORTABLE_CHILDREN=!1;class X{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?x.Rectangle.EMPTY:(t=t||new x.Rectangle(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(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)}addPointMatrix(t,s){const{a:e,b:i,c:n,d:h,tx:r,ty:a}=t,d=e*s.x+n*s.y+r,m=i*s.x+h*s.y+a;this.minX=Math.min(this.minX,d),this.maxX=Math.max(this.maxX,d),this.minY=Math.min(this.minY,m),this.maxY=Math.max(this.maxY,m)}addQuad(t){let s=this.minX,e=this.minY,i=this.maxX,n=this.maxY,h=t[0],r=t[1];s=h<s?h:s,e=r<e?r:e,i=h>i?h:i,n=r>n?r:n,h=t[2],r=t[3],s=h<s?h:s,e=r<e?r:e,i=h>i?h:i,n=r>n?r:n,h=t[4],r=t[5],s=h<s?h:s,e=r<e?r:e,i=h>i?h:i,n=r>n?r:n,h=t[6],r=t[7],s=h<s?h:s,e=r<e?r:e,i=h>i?h:i,n=r>n?r:n,this.minX=s,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,s,e,i,n){this.addFrameMatrix(t.worldTransform,s,e,i,n)}addFrameMatrix(t,s,e,i,n){const h=t.a,r=t.b,a=t.c,d=t.d,m=t.tx,b=t.ty;let f=this.minX,c=this.minY,u=this.maxX,p=this.maxY,o=h*s+a*e+m,l=r*s+d*e+b;f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=h*i+a*e+m,l=r*i+d*e+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=h*s+a*n+m,l=r*s+d*n+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=h*i+a*n+m,l=r*i+d*n+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,this.minX=f,this.minY=c,this.maxX=u,this.maxY=p}addVertexData(t,s,e){let i=this.minX,n=this.minY,h=this.maxX,r=this.maxY;for(let a=s;a<e;a+=2){const d=t[a],m=t[a+1];i=d<i?d:i,n=m<n?m:n,h=d>h?d:h,r=m>r?m:r}this.minX=i,this.minY=n,this.maxX=h,this.maxY=r}addVertices(t,s,e,i){this.addVerticesMatrix(t.worldTransform,s,e,i)}addVerticesMatrix(t,s,e,i,n=0,h=n){const r=t.a,a=t.b,d=t.c,m=t.d,b=t.tx,f=t.ty;let c=this.minX,u=this.minY,p=this.maxX,o=this.maxY;for(let l=e;l<i;l+=2){const Y=s[l],D=s[l+1],C=r*Y+d*D+b,w=m*D+a*Y+f;c=Math.min(c,C-n),p=Math.max(p,C+n),u=Math.min(u,w-h),o=Math.max(o,w+h)}this.minX=c,this.minY=u,this.maxX=p,this.maxY=o}addBounds(t){const s=this.minX,e=this.minY,i=this.maxX,n=this.maxY;this.minX=t.minX<s?t.minX:s,this.minY=t.minY<e?t.minY:e,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,s){const e=t.minX>s.minX?t.minX:s.minX,i=t.minY>s.minY?t.minY:s.minY,n=t.maxX<s.maxX?t.maxX:s.maxX,h=t.maxY<s.maxY?t.maxY:s.maxY;if(e<=n&&i<=h){const r=this.minX,a=this.minY,d=this.maxX,m=this.maxY;this.minX=e<r?e:r,this.minY=i<a?i:a,this.maxX=n>d?n:d,this.maxY=h>m?h:m}}addBoundsMatrix(t,s){this.addFrameMatrix(s,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,s){const e=t.minX>s.x?t.minX:s.x,i=t.minY>s.y?t.minY:s.y,n=t.maxX<s.x+s.width?t.maxX:s.x+s.width,h=t.maxY<s.y+s.height?t.maxY:s.y+s.height;if(e<=n&&i<=h){const r=this.minX,a=this.minY,d=this.maxX,m=this.maxY;this.minX=e<r?e:r,this.minY=i<a?i:a,this.maxX=n>d?n:d,this.maxY=h>m?h:m}}pad(t=0,s=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=s,this.maxY+=s)}addFramePad(t,s,e,i,n,h){t-=n,s-=h,e+=n,i+=h,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>e?this.maxX:e,this.minY=this.minY<s?this.minY:s,this.maxY=this.maxY>i?this.maxY:i}}class _ extends x.utils.EventEmitter{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new x.Transform,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new X,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const s=Object.keys(t);for(let e=0;e<s.length;++e){const i=s[e];Object.defineProperty(_.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,s){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),s||(this._boundsRect||(this._boundsRect=new x.Rectangle),s=this._boundsRect),this._bounds.getRectangle(s)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new x.Rectangle),t=this._localBoundsRect),this._localBounds||(this._localBounds=new X);const s=this.transform,e=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const h=this.getBounds(!1,t);return this.parent=e,this.transform=s,this._bounds=i,this._bounds.updateID+=this._boundsID-n,h}toGlobal(t,s,e=!1){return e||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,s)}toLocal(t,s,e,i){return s&&(t=s.toGlobal(t,e,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,e)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}setTransform(t=0,s=0,e=1,i=1,n=0,h=0,r=0,a=0,d=0){return this.position.x=t,this.position.y=s,this.scale.x=e||1,this.scale.y=i||1,this.rotation=n,this.skew.x=h,this.skew.y=r,this.pivot.x=a,this.pivot.y=d,this}destroy(t){this.parent&&this.parent.removeChild(this),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new I),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*x.RAD_TO_DEG}set angle(t){this.transform.rotation=t*x.DEG_TO_RAD}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount--,s._maskRefCount===0&&(s.renderable=!0,s.isMask=!1))}if(this._mask=t,this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount===0&&(s.renderable=!1,s.isMask=!0),s._maskRefCount++)}}}}class I extends _{constructor(){super(...arguments),this.sortDirty=null}}_.prototype.displayObjectUpdateTransform=_.prototype.updateTransform;function k(g,t){return g.zIndex===t.zIndex?g._lastSortedIndex-t._lastSortedIndex:g.zIndex-t.zIndex}class y extends _{constructor(){super(),this.children=[],this.sortableChildren=x.settings.SORTABLE_CHILDREN,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let s=0;s<t.length;s++)this.addChild(t[s]);else{const s=t[0];s.parent&&s.parent.removeChild(s),s.parent=this,this.sortDirty=!0,s.transform._parentID=-1,this.children.push(s),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",s,this,this.children.length-1),s.emit("added",this)}return t[0]}addChildAt(t,s){if(s<0||s>this.children.length)throw new Error(`${t}addChildAt: The index ${s} 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(s,0,t),this._boundsID++,this.onChildrenChange(s),t.emit("added",this),this.emit("childAdded",t,this,s),t}swapChildren(t,s){if(t===s)return;const e=this.getChildIndex(t),i=this.getChildIndex(s);this.children[e]=s,this.children[i]=t,this.onChildrenChange(e<i?e:i)}getChildIndex(t){const s=this.children.indexOf(t);if(s===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return s}setChildIndex(t,s){if(s<0||s>=this.children.length)throw new Error(`The index ${s} supplied is out of bounds ${this.children.length}`);const e=this.getChildIndex(t);x.utils.removeItems(this.children,e,1),this.children.splice(s,0,t),this.onChildrenChange(s)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let s=0;s<t.length;s++)this.removeChild(t[s]);else{const s=t[0],e=this.children.indexOf(s);if(e===-1)return null;s.parent=null,s.transform._parentID=-1,x.utils.removeItems(this.children,e,1),this._boundsID++,this.onChildrenChange(e),s.emit("removed",this),this.emit("childRemoved",s,this,e)}return t[0]}removeChildAt(t){const s=this.getChildAt(t);return s.parent=null,s.transform._parentID=-1,x.utils.removeItems(this.children,t,1),this._boundsID++,this.onChildrenChange(t),s.emit("removed",this),this.emit("childRemoved",s,this,t),s}removeChildren(t=0,s=this.children.length){const e=t,i=s,n=i-e;let h;if(n>0&&n<=i){h=this.children.splice(e,n);for(let r=0;r<h.length;++r)h[r].parent=null,h[r].transform&&(h[r].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let r=0;r<h.length;++r)h[r].emit("removed",this),this.emit("childRemoved",h[r],this,r);return h}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let s=0,e=this.children.length;s<e;++s){const i=this.children[s];i._lastSortedIndex=s,!t&&i.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(k),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,s=this.children.length;t<s;++t){const e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const s=this.children[t];if(!(!s.visible||!s.renderable))if(s.calculateBounds(),s._mask){const e=s._mask.isMaskData?s._mask.maskObject:s._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(s._bounds,e._bounds)):this._bounds.addBounds(s._bounds)}else s.filterArea?this._bounds.addBoundsArea(s._bounds,s.filterArea):this._bounds.addBounds(s._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,s=!1){const e=super.getLocalBounds(t);if(!s)for(let i=0,n=this.children.length;i<n;++i){const h=this.children[i];h.visible&&h.updateTransform()}return e}_calculateBounds(){}_renderWithCulling(t){const s=t.renderTexture.sourceFrame;if(!(s.width>0&&s.height>0))return;let e,i;if(this.cullArea?(e=this.cullArea,i=this.worldTransform):this._render!==y.prototype._render&&(e=this.getBounds(!0)),e&&s.intersects(e,i))this._render(t);else if(this.cullArea)return;for(let n=0,h=this.children.length;n<h;++n){const r=this.children[n],a=r.cullable;r.cullable=a||!this.cullArea,r.render(t),r.cullable=a}}render(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,e=this.children.length;s<e;++s)this.children[s].render(t)}}renderAdvanced(t){const s=this.filters,e=this._mask;if(s){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let n=0;n<s.length;n++)s[n].enabled&&this._enabledFilters.push(s[n])}const i=s&&this._enabledFilters?.length||e&&(!e.isMaskData||e.enabled&&(e.autoDetect||e.type!==x.MASK_TYPES.NONE));if(i&&t.batch.flush(),s&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),e&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let n=0,h=this.children.length;n<h;++n)this.children[n].render(t)}i&&t.batch.flush(),e&&t.mask.pop(this),s&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const s=typeof t=="boolean"?t:t?.children,e=this.removeChildren(0,this.children.length);if(s)for(let i=0;i<e.length;++i)e[i].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const s=this.getLocalBounds().width;s!==0?this.scale.x=t/s:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const s=this.getLocalBounds().height;s!==0?this.scale.y=t/s:this.scale.y=1,this._height=t}}y.prototype.containerUpdateTransform=y.prototype.updateTransform,exports.Bounds=X,exports.Container=y,exports.DisplayObject=_,exports.TemporaryDisplayObject=I;
*/Object.defineProperty(exports,"__esModule",{value:!0});var x=require("@pixi/core");x.settings.SORTABLE_CHILDREN=!1;class X{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?x.Rectangle.EMPTY:(t=t||new x.Rectangle(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(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)}addPointMatrix(t,s){const{a:e,b:i,c:n,d:r,tx:h,ty:a}=t,d=e*s.x+n*s.y+h,m=i*s.x+r*s.y+a;this.minX=Math.min(this.minX,d),this.maxX=Math.max(this.maxX,d),this.minY=Math.min(this.minY,m),this.maxY=Math.max(this.maxY,m)}addQuad(t){let s=this.minX,e=this.minY,i=this.maxX,n=this.maxY,r=t[0],h=t[1];s=r<s?r:s,e=h<e?h:e,i=r>i?r:i,n=h>n?h:n,r=t[2],h=t[3],s=r<s?r:s,e=h<e?h:e,i=r>i?r:i,n=h>n?h:n,r=t[4],h=t[5],s=r<s?r:s,e=h<e?h:e,i=r>i?r:i,n=h>n?h:n,r=t[6],h=t[7],s=r<s?r:s,e=h<e?h:e,i=r>i?r:i,n=h>n?h:n,this.minX=s,this.minY=e,this.maxX=i,this.maxY=n}addFrame(t,s,e,i,n){this.addFrameMatrix(t.worldTransform,s,e,i,n)}addFrameMatrix(t,s,e,i,n){const r=t.a,h=t.b,a=t.c,d=t.d,m=t.tx,b=t.ty;let f=this.minX,c=this.minY,u=this.maxX,p=this.maxY,o=r*s+a*e+m,l=h*s+d*e+b;f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=r*i+a*e+m,l=h*i+d*e+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=r*s+a*n+m,l=h*s+d*n+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,o=r*i+a*n+m,l=h*i+d*n+b,f=o<f?o:f,c=l<c?l:c,u=o>u?o:u,p=l>p?l:p,this.minX=f,this.minY=c,this.maxX=u,this.maxY=p}addVertexData(t,s,e){let i=this.minX,n=this.minY,r=this.maxX,h=this.maxY;for(let a=s;a<e;a+=2){const d=t[a],m=t[a+1];i=d<i?d:i,n=m<n?m:n,r=d>r?d:r,h=m>h?m:h}this.minX=i,this.minY=n,this.maxX=r,this.maxY=h}addVertices(t,s,e,i){this.addVerticesMatrix(t.worldTransform,s,e,i)}addVerticesMatrix(t,s,e,i,n=0,r=n){const h=t.a,a=t.b,d=t.c,m=t.d,b=t.tx,f=t.ty;let c=this.minX,u=this.minY,p=this.maxX,o=this.maxY;for(let l=e;l<i;l+=2){const Y=s[l],D=s[l+1],C=h*Y+d*D+b,w=m*D+a*Y+f;c=Math.min(c,C-n),p=Math.max(p,C+n),u=Math.min(u,w-r),o=Math.max(o,w+r)}this.minX=c,this.minY=u,this.maxX=p,this.maxY=o}addBounds(t){const s=this.minX,e=this.minY,i=this.maxX,n=this.maxY;this.minX=t.minX<s?t.minX:s,this.minY=t.minY<e?t.minY:e,this.maxX=t.maxX>i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,s){const e=t.minX>s.minX?t.minX:s.minX,i=t.minY>s.minY?t.minY:s.minY,n=t.maxX<s.maxX?t.maxX:s.maxX,r=t.maxY<s.maxY?t.maxY:s.maxY;if(e<=n&&i<=r){const h=this.minX,a=this.minY,d=this.maxX,m=this.maxY;this.minX=e<h?e:h,this.minY=i<a?i:a,this.maxX=n>d?n:d,this.maxY=r>m?r:m}}addBoundsMatrix(t,s){this.addFrameMatrix(s,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,s){const e=t.minX>s.x?t.minX:s.x,i=t.minY>s.y?t.minY:s.y,n=t.maxX<s.x+s.width?t.maxX:s.x+s.width,r=t.maxY<s.y+s.height?t.maxY:s.y+s.height;if(e<=n&&i<=r){const h=this.minX,a=this.minY,d=this.maxX,m=this.maxY;this.minX=e<h?e:h,this.minY=i<a?i:a,this.maxX=n>d?n:d,this.maxY=r>m?r:m}}pad(t=0,s=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=s,this.maxY+=s)}addFramePad(t,s,e,i,n,r){t-=n,s-=r,e+=n,i+=r,this.minX=this.minX<t?this.minX:t,this.maxX=this.maxX>e?this.maxX:e,this.minY=this.minY<s?this.minY:s,this.maxY=this.maxY>i?this.maxY:i}}class _ extends x.utils.EventEmitter{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new x.Transform,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new X,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const s=Object.keys(t);for(let e=0;e<s.length;++e){const i=s[e];Object.defineProperty(_.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(t,s){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),s||(this._boundsRect||(this._boundsRect=new x.Rectangle),s=this._boundsRect),this._bounds.getRectangle(s)}getLocalBounds(t){t||(this._localBoundsRect||(this._localBoundsRect=new x.Rectangle),t=this._localBoundsRect),this._localBounds||(this._localBounds=new X);const s=this.transform,e=this.parent;this.parent=null,this.transform=this._tempDisplayObjectParent.transform;const i=this._bounds,n=this._boundsID;this._bounds=this._localBounds;const r=this.getBounds(!1,t);return this.parent=e,this.transform=s,this._bounds=i,this._bounds.updateID+=this._boundsID-n,r}toGlobal(t,s,e=!1){return e||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(t,s)}toLocal(t,s,e,i){return s&&(t=s.toGlobal(t,e,i)),i||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(t,e)}setParent(t){if(!t||!t.addChild)throw new Error("setParent: Argument must be a Container");return t.addChild(this),t}removeFromParent(){this.parent?.removeChild(this)}setTransform(t=0,s=0,e=1,i=1,n=0,r=0,h=0,a=0,d=0){return this.position.x=t,this.position.y=s,this.scale.x=e||1,this.scale.y=i||1,this.rotation=n,this.skew.x=r,this.skew.y=h,this.pivot.x=a,this.pivot.y=d,this}destroy(t){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.interactive=!1,this.interactiveChildren=!1,this.emit("destroyed"),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new I),this.tempDisplayObjectParent}enableTempParent(){const t=this.parent;return this.parent=this._tempDisplayObjectParent,t}disableTempParent(t){this.parent=t}get x(){return this.position.x}set x(t){this.transform.position.x=t}get y(){return this.position.y}set y(t){this.transform.position.y=t}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(t){this.transform.position.copyFrom(t)}get scale(){return this.transform.scale}set scale(t){this.transform.scale.copyFrom(t)}get pivot(){return this.transform.pivot}set pivot(t){this.transform.pivot.copyFrom(t)}get skew(){return this.transform.skew}set skew(t){this.transform.skew.copyFrom(t)}get rotation(){return this.transform.rotation}set rotation(t){this.transform.rotation=t}get angle(){return this.transform.rotation*x.RAD_TO_DEG}set angle(t){this.transform.rotation=t*x.DEG_TO_RAD}get zIndex(){return this._zIndex}set zIndex(t){this._zIndex=t,this.parent&&(this.parent.sortDirty=!0)}get worldVisible(){let t=this;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}get mask(){return this._mask}set mask(t){if(this._mask!==t){if(this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount--,s._maskRefCount===0&&(s.renderable=!0,s.isMask=!1))}if(this._mask=t,this._mask){const s=this._mask.isMaskData?this._mask.maskObject:this._mask;s&&(s._maskRefCount===0&&(s.renderable=!1,s.isMask=!0),s._maskRefCount++)}}}}class I extends _{constructor(){super(...arguments),this.sortDirty=null}}_.prototype.displayObjectUpdateTransform=_.prototype.updateTransform;function k(g,t){return g.zIndex===t.zIndex?g._lastSortedIndex-t._lastSortedIndex:g.zIndex-t.zIndex}class y extends _{constructor(){super(),this.children=[],this.sortableChildren=x.settings.SORTABLE_CHILDREN,this.sortDirty=!1}onChildrenChange(t){}addChild(...t){if(t.length>1)for(let s=0;s<t.length;s++)this.addChild(t[s]);else{const s=t[0];s.parent&&s.parent.removeChild(s),s.parent=this,this.sortDirty=!0,s.transform._parentID=-1,this.children.push(s),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit("childAdded",s,this,this.children.length-1),s.emit("added",this)}return t[0]}addChildAt(t,s){if(s<0||s>this.children.length)throw new Error(`${t}addChildAt: The index ${s} 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(s,0,t),this._boundsID++,this.onChildrenChange(s),t.emit("added",this),this.emit("childAdded",t,this,s),t}swapChildren(t,s){if(t===s)return;const e=this.getChildIndex(t),i=this.getChildIndex(s);this.children[e]=s,this.children[i]=t,this.onChildrenChange(e<i?e:i)}getChildIndex(t){const s=this.children.indexOf(t);if(s===-1)throw new Error("The supplied DisplayObject must be a child of the caller");return s}setChildIndex(t,s){if(s<0||s>=this.children.length)throw new Error(`The index ${s} supplied is out of bounds ${this.children.length}`);const e=this.getChildIndex(t);x.utils.removeItems(this.children,e,1),this.children.splice(s,0,t),this.onChildrenChange(s)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let s=0;s<t.length;s++)this.removeChild(t[s]);else{const s=t[0],e=this.children.indexOf(s);if(e===-1)return null;s.parent=null,s.transform._parentID=-1,x.utils.removeItems(this.children,e,1),this._boundsID++,this.onChildrenChange(e),s.emit("removed",this),this.emit("childRemoved",s,this,e)}return t[0]}removeChildAt(t){const s=this.getChildAt(t);return s.parent=null,s.transform._parentID=-1,x.utils.removeItems(this.children,t,1),this._boundsID++,this.onChildrenChange(t),s.emit("removed",this),this.emit("childRemoved",s,this,t),s}removeChildren(t=0,s=this.children.length){const e=t,i=s,n=i-e;let r;if(n>0&&n<=i){r=this.children.splice(e,n);for(let h=0;h<r.length;++h)r[h].parent=null,r[h].transform&&(r[h].transform._parentID=-1);this._boundsID++,this.onChildrenChange(t);for(let h=0;h<r.length;++h)r[h].emit("removed",this),this.emit("childRemoved",r[h],this,h);return r}else if(n===0&&this.children.length===0)return[];throw new RangeError("removeChildren: numeric values are outside the acceptable range.")}sortChildren(){let t=!1;for(let s=0,e=this.children.length;s<e;++s){const i=this.children[s];i._lastSortedIndex=s,!t&&i.zIndex!==0&&(t=!0)}t&&this.children.length>1&&this.children.sort(k),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,s=this.children.length;t<s;++t){const e=this.children[t];e.visible&&e.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let t=0;t<this.children.length;t++){const s=this.children[t];if(!(!s.visible||!s.renderable))if(s.calculateBounds(),s._mask){const e=s._mask.isMaskData?s._mask.maskObject:s._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(s._bounds,e._bounds)):this._bounds.addBounds(s._bounds)}else s.filterArea?this._bounds.addBoundsArea(s._bounds,s.filterArea):this._bounds.addBounds(s._bounds)}this._bounds.updateID=this._boundsID}getLocalBounds(t,s=!1){const e=super.getLocalBounds(t);if(!s)for(let i=0,n=this.children.length;i<n;++i){const r=this.children[i];r.visible&&r.updateTransform()}return e}_calculateBounds(){}_renderWithCulling(t){const s=t.renderTexture.sourceFrame;if(!(s.width>0&&s.height>0))return;let e,i;if(this.cullArea?(e=this.cullArea,i=this.worldTransform):this._render!==y.prototype._render&&(e=this.getBounds(!0)),e&&s.intersects(e,i))this._render(t);else if(this.cullArea)return;for(let n=0,r=this.children.length;n<r;++n){const h=this.children[n],a=h.cullable;h.cullable=a||!this.cullArea,h.render(t),h.cullable=a}}render(t){if(!(!this.visible||this.worldAlpha<=0||!this.renderable))if(this._mask||this.filters?.length)this.renderAdvanced(t);else if(this.cullable)this._renderWithCulling(t);else{this._render(t);for(let s=0,e=this.children.length;s<e;++s)this.children[s].render(t)}}renderAdvanced(t){const s=this.filters,e=this._mask;if(s){this._enabledFilters||(this._enabledFilters=[]),this._enabledFilters.length=0;for(let n=0;n<s.length;n++)s[n].enabled&&this._enabledFilters.push(s[n])}const i=s&&this._enabledFilters?.length||e&&(!e.isMaskData||e.enabled&&(e.autoDetect||e.type!==x.MASK_TYPES.NONE));if(i&&t.batch.flush(),s&&this._enabledFilters?.length&&t.filter.push(this,this._enabledFilters),e&&t.mask.push(this,this._mask),this.cullable)this._renderWithCulling(t);else{this._render(t);for(let n=0,r=this.children.length;n<r;++n)this.children[n].render(t)}i&&t.batch.flush(),e&&t.mask.pop(this),s&&this._enabledFilters?.length&&t.filter.pop()}_render(t){}destroy(t){super.destroy(),this.sortDirty=!1;const s=typeof t=="boolean"?t:t?.children,e=this.removeChildren(0,this.children.length);if(s)for(let i=0;i<e.length;++i)e[i].destroy(t)}get width(){return this.scale.x*this.getLocalBounds().width}set width(t){const s=this.getLocalBounds().width;s!==0?this.scale.x=t/s:this.scale.x=1,this._width=t}get height(){return this.scale.y*this.getLocalBounds().height}set height(t){const s=this.getLocalBounds().height;s!==0?this.scale.y=t/s:this.scale.y=1,this._height=t}}y.prototype.containerUpdateTransform=y.prototype.updateTransform,exports.Bounds=X,exports.Container=y,exports.DisplayObject=_,exports.TemporaryDisplayObject=I;
//# sourceMappingURL=display.min.js.map

@@ -759,2 +759,4 @@ /// <reference path="./global.d.ts" />

setParent(container: Container): Container;
/** Remove the DisplayObject from its parent Container. If the DisplayObject has no parent, do nothing. */
removeFromParent(): void;
/**

@@ -761,0 +763,0 @@ * Convenience function to set the position, scale, skew and pivot at once.

{
"name": "@pixi/display",
"version": "7.0.0-beta.2",
"version": "7.0.0-beta.3",
"main": "dist/cjs/display.js",

@@ -41,3 +41,3 @@ "module": "dist/esm/display.mjs",

],
"gitHead": "b82316094043a2a45a0c305068e5ebe8321f668a"
"gitHead": "8055ae1c16d4c0f8dabda86cafd8e68c356450e8"
}

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

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