Socket
Socket
Sign inDemoInstall

@pixi/sprite

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/sprite - npm Package Compare versions

Comparing version 5.1.5 to 5.2.0

9

dist/sprite.js
/*!
* @pixi/sprite - v5.1.5
* Compiled Tue, 24 Sep 2019 04:07:05 UTC
* @pixi/sprite - v5.2.0
* Compiled Wed, 06 Nov 2019 02:32:43 UTC
*

@@ -649,2 +649,7 @@ * @pixi/sprite is licensed under the MIT License.

if (this._texture)
{
this._texture.off('update', this._onTextureUpdate, this);
}
this._texture = value || core.Texture.EMPTY;

@@ -651,0 +656,0 @@ this._cachedTint = 0xFFFFFF;

/*!
* @pixi/sprite - v5.1.5
* Compiled Tue, 24 Sep 2019 04:07:05 UTC
* @pixi/sprite - v5.2.0
* Compiled Wed, 06 Nov 2019 02:32:43 UTC
*

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

*/
this.PIXI=this.PIXI||{};var _pixi_sprite=function(t,e,i,r,s,h,n){"use strict";var o=new e.Point,a=new Uint16Array([0,1,2,0,2,3]),u=function(t){function h(i){t.call(this),this._anchor=new e.ObservablePoint(this._onAnchorUpdate,this,i?i.defaultAnchor.x:0,i?i.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tint=null,this._tintRGB=null,this.tint=16777215,this.blendMode=s.BLEND_MODES.NORMAL,this.shader=null,this._cachedTint=16777215,this.uvs=null,this.texture=i||r.Texture.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=a,this.size=4,this.start=0,this.pluginName="batch",this.isSprite=!0,this._roundPixels=n.settings.ROUND_PIXELS}t&&(h.__proto__=t),h.prototype=Object.create(t&&t.prototype),h.prototype.constructor=h;var u={roundPixels:{configurable:!0},width:{configurable:!0},height:{configurable:!0},anchor:{configurable:!0},tint:{configurable:!0},texture:{configurable:!0}};return h.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=i.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=i.sign(this.scale.y)*this._height/this._texture.orig.height)},h.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},h.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,h=e.d,n=e.tx,o=e.ty,a=this.vertexData,u=t.trim,_=t.orig,c=this._anchor,d=0,l=0,x=0,f=0;if(u?(d=(l=u.x-c._x*_.width)+u.width,x=(f=u.y-c._y*_.height)+u.height):(d=(l=-c._x*_.width)+_.width,x=(f=-c._y*_.height)+_.height),a[0]=i*l+s*f+n,a[1]=h*f+r*l+o,a[2]=i*d+s*f+n,a[3]=h*f+r*d+o,a[4]=i*d+s*x+n,a[5]=h*x+r*d+o,a[6]=i*l+s*x+n,a[7]=h*x+r*l+o,this._roundPixels)for(var g=0;g<8;g++)a[g]=Math.round(a[g])}},h.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,s=this.transform.worldTransform,h=s.a,n=s.b,o=s.c,a=s.d,u=s.tx,_=s.ty,c=-r._x*i.width,d=c+i.width,l=-r._y*i.height,x=l+i.height;e[0]=h*c+o*l+u,e[1]=a*l+n*c+_,e[2]=h*d+o*l+u,e[3]=a*l+n*d+_,e[4]=h*d+o*x+u,e[5]=a*x+n*d+_,e[6]=h*c+o*x+u,e[7]=a*x+n*c+_},h.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},h.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},h.prototype.getLocalBounds=function(i){return 0===this.children.length?(this._bounds.minX=this._texture.orig.width*-this._anchor._x,this._bounds.minY=this._texture.orig.height*-this._anchor._y,this._bounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._bounds.maxY=this._texture.orig.height*(1-this._anchor._y),i||(this._localBoundsRect||(this._localBoundsRect=new e.Rectangle),i=this._localBoundsRect),this._bounds.getRectangle(i)):t.prototype.getLocalBounds.call(this,i)},h.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,o);var e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,s=0;return o.x>=r&&o.x<r+e&&(s=-i*this.anchor.y,o.y>=s&&o.y<s+i)},h.prototype.destroy=function(e){if(t.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof e?e:e&&e.texture){var i="boolean"==typeof e?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null,this.shader=null},h.from=function(t,e){return new h(t instanceof r.Texture?t:r.Texture.from(t,e))},u.roundPixels.set=function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},u.roundPixels.get=function(){return this._roundPixels},u.width.get=function(){return Math.abs(this.scale.x)*this._texture.orig.width},u.width.set=function(t){var e=i.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},u.height.get=function(){return Math.abs(this.scale.y)*this._texture.orig.height},u.height.set=function(t){var e=i.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},u.anchor.get=function(){return this._anchor},u.anchor.set=function(t){this._anchor.copyFrom(t)},u.tint.get=function(){return this._tint},u.tint.set=function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},u.texture.get=function(){return this._texture},u.texture.set=function(t){this._texture!==t&&(this._texture=t||r.Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},Object.defineProperties(h.prototype,u),h}(h.Container);return t.Sprite=u,t}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_sprite);
this.PIXI=this.PIXI||{};var _pixi_sprite=function(t,e,i,r,s,h,n){"use strict";var o=new e.Point,u=new Uint16Array([0,1,2,0,2,3]),a=function(t){function h(i){t.call(this),this._anchor=new e.ObservablePoint(this._onAnchorUpdate,this,i?i.defaultAnchor.x:0,i?i.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tint=null,this._tintRGB=null,this.tint=16777215,this.blendMode=s.BLEND_MODES.NORMAL,this.shader=null,this._cachedTint=16777215,this.uvs=null,this.texture=i||r.Texture.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=u,this.size=4,this.start=0,this.pluginName="batch",this.isSprite=!0,this._roundPixels=n.settings.ROUND_PIXELS}t&&(h.__proto__=t),h.prototype=Object.create(t&&t.prototype),h.prototype.constructor=h;var a={roundPixels:{configurable:!0},width:{configurable:!0},height:{configurable:!0},anchor:{configurable:!0},tint:{configurable:!0},texture:{configurable:!0}};return h.prototype._onTextureUpdate=function(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=i.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=i.sign(this.scale.y)*this._height/this._texture.orig.height)},h.prototype._onAnchorUpdate=function(){this._transformID=-1,this._transformTrimmedID=-1},h.prototype.calculateVertices=function(){var t=this._texture;if(this._transformID!==this.transform._worldID||this._textureID!==t._updateID){this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;var e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,h=e.d,n=e.tx,o=e.ty,u=this.vertexData,a=t.trim,_=t.orig,c=this._anchor,d=0,l=0,x=0,f=0;if(a?(d=(l=a.x-c._x*_.width)+a.width,x=(f=a.y-c._y*_.height)+a.height):(d=(l=-c._x*_.width)+_.width,x=(f=-c._y*_.height)+_.height),u[0]=i*l+s*f+n,u[1]=h*f+r*l+o,u[2]=i*d+s*f+n,u[3]=h*f+r*d+o,u[4]=i*d+s*x+n,u[5]=h*x+r*d+o,u[6]=i*l+s*x+n,u[7]=h*x+r*l+o,this._roundPixels)for(var g=0;g<8;g++)u[g]=Math.round(u[g])}},h.prototype.calculateTrimmedVertices=function(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;var t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,s=this.transform.worldTransform,h=s.a,n=s.b,o=s.c,u=s.d,a=s.tx,_=s.ty,c=-r._x*i.width,d=c+i.width,l=-r._y*i.height,x=l+i.height;e[0]=h*c+o*l+a,e[1]=u*l+n*c+_,e[2]=h*d+o*l+a,e[3]=u*l+n*d+_,e[4]=h*d+o*x+a,e[5]=u*x+n*d+_,e[6]=h*c+o*x+a,e[7]=u*x+n*c+_},h.prototype._render=function(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)},h.prototype._calculateBounds=function(){var t=this._texture.trim,e=this._texture.orig;!t||t.width===e.width&&t.height===e.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))},h.prototype.getLocalBounds=function(i){return 0===this.children.length?(this._bounds.minX=this._texture.orig.width*-this._anchor._x,this._bounds.minY=this._texture.orig.height*-this._anchor._y,this._bounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._bounds.maxY=this._texture.orig.height*(1-this._anchor._y),i||(this._localBoundsRect||(this._localBoundsRect=new e.Rectangle),i=this._localBoundsRect),this._bounds.getRectangle(i)):t.prototype.getLocalBounds.call(this,i)},h.prototype.containsPoint=function(t){this.worldTransform.applyInverse(t,o);var e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,s=0;return o.x>=r&&o.x<r+e&&(s=-i*this.anchor.y,o.y>=s&&o.y<s+i)},h.prototype.destroy=function(e){if(t.prototype.destroy.call(this,e),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof e?e:e&&e.texture){var i="boolean"==typeof e?e:e&&e.baseTexture;this._texture.destroy(!!i)}this._texture=null,this.shader=null},h.from=function(t,e){return new h(t instanceof r.Texture?t:r.Texture.from(t,e))},a.roundPixels.set=function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},a.roundPixels.get=function(){return this._roundPixels},a.width.get=function(){return Math.abs(this.scale.x)*this._texture.orig.width},a.width.set=function(t){var e=i.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},a.height.get=function(){return Math.abs(this.scale.y)*this._texture.orig.height},a.height.set=function(t){var e=i.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},a.anchor.get=function(){return this._anchor},a.anchor.set=function(t){this._anchor.copyFrom(t)},a.tint.get=function(){return this._tint},a.tint.set=function(t){this._tint=t,this._tintRGB=(t>>16)+(65280&t)+((255&t)<<16)},a.texture.get=function(){return this._texture},a.texture.set=function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||r.Texture.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},Object.defineProperties(h.prototype,a),h}(h.Container);return t.Sprite=a,t}({},PIXI,PIXI.utils,PIXI,PIXI,PIXI,PIXI);Object.assign(this.PIXI,_pixi_sprite);
//# sourceMappingURL=sprite.min.js.map
/*!
* @pixi/sprite - v5.1.5
* Compiled Tue, 24 Sep 2019 04:07:05 UTC
* @pixi/sprite - v5.2.0
* Compiled Wed, 06 Nov 2019 02:32:43 UTC
*

@@ -652,2 +652,7 @@ * @pixi/sprite is licensed under the MIT License.

if (this._texture)
{
this._texture.off('update', this._onTextureUpdate, this);
}
this._texture = value || Texture.EMPTY;

@@ -654,0 +659,0 @@ this._cachedTint = 0xFFFFFF;

/*!
* @pixi/sprite - v5.1.5
* Compiled Tue, 24 Sep 2019 04:07:05 UTC
* @pixi/sprite - v5.2.0
* Compiled Wed, 06 Nov 2019 02:32:43 UTC
*

@@ -656,2 +656,7 @@ * @pixi/sprite is licensed under the MIT License.

if (this._texture)
{
this._texture.off('update', this._onTextureUpdate, this);
}
this._texture = value || core.Texture.EMPTY;

@@ -658,0 +663,0 @@ this._cachedTint = 0xFFFFFF;

{
"name": "@pixi/sprite",
"version": "5.1.5",
"version": "5.2.0",
"main": "lib/sprite.js",

@@ -27,10 +27,10 @@ "module": "lib/sprite.es.js",

"dependencies": {
"@pixi/constants": "^5.1.0",
"@pixi/core": "^5.1.5",
"@pixi/display": "^5.1.3",
"@pixi/math": "^5.1.0",
"@pixi/settings": "^5.1.3",
"@pixi/utils": "^5.1.3"
"@pixi/constants": "^5.2.0",
"@pixi/core": "^5.2.0",
"@pixi/display": "^5.2.0",
"@pixi/math": "^5.2.0",
"@pixi/settings": "^5.2.0",
"@pixi/utils": "^5.2.0"
},
"gitHead": "8cf3db88d06355cbabea64150cdb0774191e502c"
"gitHead": "aaf96b460582b83a1fa73037ef2dd69dd9e84415"
}

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