Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

troika-2d

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

troika-2d - npm Package Compare versions

Comparing version 0.17.0 to 0.17.1

9

dist/troika-2d.esm.js

@@ -337,4 +337,4 @@ import { PointerEventTarget, utils, WorldBaseFacade, ReactCanvasBase } from 'troika-core';

afterUpdate() {
this.children = {
describeChildren() {
return {
key: 'bg',

@@ -347,8 +347,5 @@ facade: BackgroundFacade,

children: this.objects
};
super.afterUpdate();
}
}
doRender() {

@@ -355,0 +352,0 @@ let canvas = this._element;

@@ -393,4 +393,4 @@ (function (global, factory) {

World2DFacade.prototype.afterUpdate = function afterUpdate () {
this.children = {
World2DFacade.prototype.describeChildren = function describeChildren () {
return {
key: 'bg',

@@ -403,8 +403,5 @@ facade: BackgroundFacade,

children: this.objects
};
WorldBaseFacade.prototype.afterUpdate.call(this);
}
};
World2DFacade.prototype.doRender = function doRender () {

@@ -411,0 +408,0 @@ var canvas = this._element;

@@ -11,6 +11,6 @@ 'use strict';(function(d,e){"object"===typeof exports&&"undefined"!==typeof module?e(exports,require("troika-core"),require("react"),require("prop-types")):"function"===typeof define&&define.amd?define(["exports","troika-core","react","prop-types"],e):(d=d||self,e(d.troika_2d={},d.troika_core,d.React,d.PropTypes))})(this,function(d,e,l,g){function n(c,a){var b="\u27a4"+c;Object.defineProperty(m.prototype,c,{get:function(){return b in this?this[b]:a},set:function(a){this[b]!==a&&(this[b]=a,this._matrixChanged=

arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.render=function(b){null!=this.color&&(b.fillStyle=this.color,b.fillRect(0,0,this.width,this.height))};a.prototype.hitTest=function(b,a){return!0};return a}(m);v.prototype.z=-Infinity;var w=function(c){function a(b){c.call(this,b);this._context=b.getContext("2d");this._onBgClick=this._onBgClick.bind(this)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=
a;a.prototype.afterUpdate=function(){this.children={key:"bg",facade:v,color:this.backgroundColor,width:this.width,height:this.height,onClick:this.onBackgroundClick?this._onBgClick:null,children:this.objects};c.prototype.afterUpdate.call(this)};a.prototype.doRender=function(){var b=this._element,a=this._context,c=this.height,d=this.pixelRatio||window.devicePixelRatio||1;b.width=this.width*d;b.height=c*d;a.setTransform(d,0,0,d,0,0);b=this.getChildByKey("bg");r(b,function(b){a.save();var c=b.worldTransformMatrix;
a.transform(c[0],c[1],c[2],c[3],c[4],c[5]);b.render(a);a.restore()})};a.prototype.getFacadeUserSpaceXYZ=function(b){var a=b.getProjectedPosition(0,0);b=b.z;return{x:a.x,y:a.y,z:1<b?1/b:1-b}};a.prototype.getFacadesAtEvent=function(a,c){var b=a.target.getBoundingClientRect(),d=a.clientX-b.left,e=a.clientY-b.top,h=null,g=0;r(this.getChildByKey("bg"),function(a){c&&!c(a)||!a.hitTest(d,e)||(h||(h=Object.create(null)),h[a.$facadeId]={facade:a,distance:g--})});h&&(h=Object.keys(h).map(function(a){return h[a]}));
return h};a.prototype._onBgClick=function(a){if(a.target===a.currentTarget)this.onBackgroundClick(a)};return a}(e.WorldBaseFacade),t=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.render=function(){var a=this.props;return l.createElement(e.ReactCanvasBase,e.utils.assign({},a,{worldFacade:a.worldFacade||w,worldProps:e.utils.assign({},{backgroundColor:a.backgroundColor,onBackgroundClick:a.onBackgroundClick,
objects:a.objects},a.worldProps)}),a.children)};return a}(l.Component);t.displayName="Canvas2D";t.propTypes=e.utils.assignIf({backgroundColor:g.any,objects:g.oneOfType([g.array,g.object]).isRequired,onBackgroundClick:g.func},e.ReactCanvasBase.commonPropTypes);Object.defineProperty(d,"Facade",{enumerable:!0,get:function(){return e.Facade}});Object.defineProperty(d,"ListFacade",{enumerable:!0,get:function(){return e.ListFacade}});Object.defineProperty(d,"ParentFacade",{enumerable:!0,get:function(){return e.ParentFacade}});
d.Canvas2D=t;d.Group2DFacade=q;d.HtmlOverlay2DFacade=B;d.Object2DFacade=m;d.Text2DFacade=u;d.World2DFacade=w;Object.defineProperty(d,"__esModule",{value:!0})});
a;a.prototype.describeChildren=function(){return{key:"bg",facade:v,color:this.backgroundColor,width:this.width,height:this.height,onClick:this.onBackgroundClick?this._onBgClick:null,children:this.objects}};a.prototype.doRender=function(){var b=this._element,a=this._context,c=this.height,d=this.pixelRatio||window.devicePixelRatio||1;b.width=this.width*d;b.height=c*d;a.setTransform(d,0,0,d,0,0);b=this.getChildByKey("bg");r(b,function(b){a.save();var c=b.worldTransformMatrix;a.transform(c[0],c[1],c[2],
c[3],c[4],c[5]);b.render(a);a.restore()})};a.prototype.getFacadeUserSpaceXYZ=function(b){var a=b.getProjectedPosition(0,0);b=b.z;return{x:a.x,y:a.y,z:1<b?1/b:1-b}};a.prototype.getFacadesAtEvent=function(a,c){var b=a.target.getBoundingClientRect(),d=a.clientX-b.left,e=a.clientY-b.top,h=null,g=0;r(this.getChildByKey("bg"),function(a){c&&!c(a)||!a.hitTest(d,e)||(h||(h=Object.create(null)),h[a.$facadeId]={facade:a,distance:g--})});h&&(h=Object.keys(h).map(function(a){return h[a]}));return h};a.prototype._onBgClick=
function(a){if(a.target===a.currentTarget)this.onBackgroundClick(a)};return a}(e.WorldBaseFacade),t=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.render=function(){var a=this.props;return l.createElement(e.ReactCanvasBase,e.utils.assign({},a,{worldFacade:a.worldFacade||w,worldProps:e.utils.assign({},{backgroundColor:a.backgroundColor,onBackgroundClick:a.onBackgroundClick,objects:a.objects},a.worldProps)}),
a.children)};return a}(l.Component);t.displayName="Canvas2D";t.propTypes=e.utils.assignIf({backgroundColor:g.any,objects:g.oneOfType([g.array,g.object]).isRequired,onBackgroundClick:g.func},e.ReactCanvasBase.commonPropTypes);Object.defineProperty(d,"Facade",{enumerable:!0,get:function(){return e.Facade}});Object.defineProperty(d,"ListFacade",{enumerable:!0,get:function(){return e.ListFacade}});Object.defineProperty(d,"ParentFacade",{enumerable:!0,get:function(){return e.ParentFacade}});d.Canvas2D=
t;d.Group2DFacade=q;d.HtmlOverlay2DFacade=B;d.Object2DFacade=m;d.Text2DFacade=u;d.World2DFacade=w;Object.defineProperty(d,"__esModule",{value:!0})});
{
"name": "troika-2d",
"version": "0.17.0",
"version": "0.17.1",
"description": "Troika 2D",

@@ -16,7 +16,7 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>",

"module": "dist/troika-2d.esm.js",
"module:es2015": "src/index.js",
"module:src": "src/index.js",
"dependencies": {
"troika-core": "^0.17.0"
"troika-core": "^0.17.1"
},
"gitHead": "31909f4beed23f5913aa380db1dd3c1802798b39"
"gitHead": "0708fdbb59d0073095124b1ac669bbe84fc640e9"
}

@@ -54,4 +54,4 @@ import { WorldBaseFacade } from 'troika-core'

afterUpdate() {
this.children = {
describeChildren() {
return {
key: 'bg',

@@ -65,7 +65,4 @@ facade: BackgroundFacade,

}
super.afterUpdate()
}
doRender() {

@@ -72,0 +69,0 @@ let canvas = this._element

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