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

pure-canvas

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pure-canvas - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

.idea/codeStyleSettings.xml

18

lib/Scale.js

@@ -7,3 +7,3 @@ "use strict";

};
var Layer_1 = require('./Layer');
var Transformer_1 = require('./Transformer');
var Scale = (function (_super) {

@@ -25,6 +25,6 @@ __extends(Scale, _super);

return {
minX: minX * this._x,
minY: minY * this._y,
maxX: maxX * this._x,
maxY: maxY * this._y
minX: this._x >= 0 ? minX * this._x : maxX * this._x,
minY: this._y >= 0 ? minY * this._y : maxY * this._y,
maxX: this._x >= 0 ? maxX * this._x : minX * this._x,
maxY: this._y >= 0 ? maxY * this._y : minY * this._y
};

@@ -42,8 +42,2 @@ };

};
Scale.prototype.index = function (action, zIndex) {
var _this = this;
_super.prototype.index.call(this, function (node, zIndex, transformers) {
action(node, zIndex, transformers.concat([_this]));
}, zIndex);
};
Object.defineProperty(Scale.prototype, "x", {

@@ -70,3 +64,3 @@ get: function () {

return Scale;
}(Layer_1.default));
}(Transformer_1.default));
Object.defineProperty(exports, "__esModule", { value: true });

@@ -73,0 +67,0 @@ exports.default = Scale;

@@ -58,2 +58,3 @@ "use strict";

var point_1 = _this.eventToElementCoordinate(event);
// console.log(this.tree.search({minX: point.x, minY: point.y, maxX: point.x, maxY: point.y}));
var results = _this.tree

@@ -83,5 +84,14 @@ .search({ minX: point_1.x, minY: point_1.y, maxX: point_1.x, maxY: point_1.y })

var bounds = node.getBounds();
var _a = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.minX, y: bounds.minY }), minX = _a.x, minY = _a.y;
var _b = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.maxX, y: bounds.maxY }), maxX = _b.x, maxY = _b.y;
_this.tree.insert({ minX: minX, minY: minY, maxX: maxX, maxY: maxY, transformers: transformers, node: node, zIndex: zIndex });
var _a = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.minX, y: bounds.minY }), x1 = _a.x, y1 = _a.y;
var _b = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.maxX, y: bounds.maxY }), x2 = _b.x, y2 = _b.y;
var _c = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.minX, y: bounds.maxY }), x3 = _c.x, y3 = _c.y;
var _d = transformers.reduce(function (point, transformer) { return transformer.transform(point); }, { x: bounds.maxX, y: bounds.minY }), x4 = _d.x, y4 = _d.y;
var minX = Math.min(x1, x2, x3, x4);
var minY = Math.min(y1, y2, y3, y4);
var maxX = Math.max(x1, x2, x3, x4);
var maxY = Math.max(y1, y2, y3, y4);
_this.tree.insert({
minX: minX, minY: minY, maxX: maxX, maxY: maxY,
transformers: transformers, node: node, zIndex: zIndex
});
}, 0);

@@ -88,0 +98,0 @@ };

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Layer_1 = require('./Layer');
var Transformer = (function (_super) {
__extends(Transformer, _super);
function Transformer() {
_super.apply(this, arguments);
}
Transformer.prototype.index = function (action, zIndex) {
var _this = this;
_super.prototype.index.call(this, function (node, zIndex, transformers) {
action(node, zIndex, transformers.concat([_this]));
}, zIndex);
};
return Transformer;
}(Layer_1.default));
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Transformer;
//# sourceMappingURL=Transformer.js.map

@@ -7,3 +7,3 @@ "use strict";

};
var Layer_1 = require('./Layer');
var Transformer_1 = require('./Transformer');
var Translate = (function (_super) {

@@ -41,8 +41,2 @@ __extends(Translate, _super);

};
Translate.prototype.index = function (action, zIndex) {
var _this = this;
_super.prototype.index.call(this, function (node, zIndex, transformers) {
action(node, zIndex, transformers.concat([_this]));
}, zIndex);
};
Object.defineProperty(Translate.prototype, "x", {

@@ -69,3 +63,3 @@ get: function () {

return Translate;
}(Layer_1.default));
}(Transformer_1.default));
Object.defineProperty(exports, "__esModule", { value: true });

@@ -72,0 +66,0 @@ exports.default = Translate;

{
"name": "pure-canvas",
"version": "0.1.9",
"version": "0.1.10",
"description": "TODO",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1,6 +0,5 @@

import Layer from './Layer';
import Node, {Bounds, Point} from './Node';
import Transformer from './Transformer';
export default class Scale extends Layer implements Transformer {
export default class Scale extends Transformer {
private _x: number;

@@ -25,6 +24,6 @@

return {
minX: minX * this._x,
minY: minY * this._y,
maxX: maxX * this._x,
maxY: maxY * this._y
minX: this._x >= 0 ? minX * this._x : maxX * this._x,
minY: this._y >= 0 ? minY * this._y : maxY * this._y,
maxX: this._x >= 0 ? maxX * this._x : minX * this._x,
maxY: this._y >= 0 ? maxY * this._y : minY * this._y
};

@@ -46,8 +45,2 @@ }

index(action: (node: Node, zIndex: number, transformers: Array<Transformer>) => void, zIndex: number): void {
super.index((node: Node, zIndex: number, transformers: Array<Transformer>) => {
action(node, zIndex, [...transformers, this]);
}, zIndex);
}
get x(): number {

@@ -54,0 +47,0 @@ return this._x;

@@ -1,2 +0,2 @@

import Node, {Bounds, Point} from './Node';
import Node, {Point} from './Node';
import NodeIndexable from './NodeIndexable';

@@ -56,2 +56,5 @@ import NodeCollection from './NodeCollection';

const point = this.eventToElementCoordinate(event);
// console.log(this.tree.search({minX: point.x, minY: point.y, maxX: point.x, maxY: point.y}));
const results = this.tree

@@ -98,5 +101,14 @@ .search({minX: point.x, minY: point.y, maxX: point.x, maxY: point.y})

const bounds = node.getBounds();
const {x: minX, y: minY} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.minX, y: bounds.minY})
const {x: maxX, y: maxY} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.maxX, y: bounds.maxY})
this.tree.insert({minX, minY, maxX, maxY, transformers, node, zIndex});
const {x: x1, y: y1} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.minX, y: bounds.minY});
const {x: x2, y: y2} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.maxX, y: bounds.maxY});
const {x: x3, y: y3} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.minX, y: bounds.maxY});
const {x: x4, y: y4} = transformers.reduce((point: Point, transformer: Transformer) => transformer.transform(point), {x: bounds.maxX, y: bounds.minY});
const minX = Math.min(x1, x2, x3, x4);
const minY = Math.min(y1, y2, y3, y4);
const maxX = Math.max(x1, x2, x3, x4);
const maxY = Math.max(y1, y2, y3, y4);
this.tree.insert({
minX, minY, maxX, maxY,
transformers, node, zIndex
});
}, 0);

@@ -103,0 +115,0 @@ }

@@ -1,9 +0,16 @@

import {Point} from './Node';
import Node, {Point} from './Node';
import Layer from './Layer';
interface Transformer {
transform(point: Point): Point;
abstract class Transformer extends Layer {
abstract transform(point: Point): Point;
untransform(point: Point): Point;
abstract untransform(point: Point): Point;
index(action: (node: Node, zIndex: number, transformers: Array<Transformer>) => void, zIndex: number): void {
super.index((node: Node, zIndex: number, transformers: Array<Transformer>) => {
action(node, zIndex, [...transformers, this]);
}, zIndex);
}
}
export default Transformer;

@@ -1,6 +0,5 @@

import Layer from './Layer';
import Node, {Bounds, Point} from './Node';
import Transformer from './Transformer';
export default class Translate extends Layer implements Transformer {
export default class Translate extends Transformer {
private _x: number;

@@ -45,8 +44,2 @@

index(action: (node: Node, zIndex: number, transformers: Array<Transformer>) => void, zIndex: number): void {
super.index((node: Node, zIndex: number, transformers: Array<Transformer>) => {
action(node, zIndex, [...transformers, this]);
}, zIndex);
}
get x(): number {

@@ -53,0 +46,0 @@ return this._x;

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

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