New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.5.1 to 0.5.2

30

lib/LayerCached.js

@@ -25,16 +25,22 @@ "use strict";

};
LayerCached.prototype.invalidateBounds = function () {
this.cachedBounds = undefined;
};
LayerCached.prototype.getBounds = function () {
if (this.clipRegion) {
var _a = this.clipRegion, clipMinX = _a.minX, clipMinY = _a.minY, clipMaxX = _a.maxX, clipMaxY = _a.maxY;
var _b = _super.prototype.getBounds.call(this), minX = _b.minX, minY = _b.minY, maxX = _b.maxX, maxY = _b.maxY;
return {
minX: Math.max(minX, clipMinX),
minY: Math.max(minY, clipMinY),
maxX: Math.min(maxX, clipMaxX),
maxY: Math.min(maxY, clipMaxY)
};
if (!this.cachedBounds) {
if (this.clipRegion) {
var _a = this.clipRegion, clipMinX = _a.minX, clipMinY = _a.minY, clipMaxX = _a.maxX, clipMaxY = _a.maxY;
var _b = _super.prototype.getBounds.call(this), minX = _b.minX, minY = _b.minY, maxX = _b.maxX, maxY = _b.maxY;
this.cachedBounds = {
minX: Math.max(minX, clipMinX),
minY: Math.max(minY, clipMinY),
maxX: Math.min(maxX, clipMaxX),
maxY: Math.min(maxY, clipMaxY)
};
}
else {
this.cachedBounds = _super.prototype.getBounds.call(this);
}
}
else {
return _super.prototype.getBounds.call(this);
}
return this.cachedBounds;
};

@@ -41,0 +47,0 @@ LayerCached.prototype.draw = function (context) {

2

package.json
{
"name": "pure-canvas",
"version": "0.5.1",
"version": "0.5.2",
"description": "TODO",

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

@@ -17,2 +17,4 @@ import Node, {Bounds, Point} from './Node';

private cachedBounds?: Bounds;
private treeManager: TreeManager;

@@ -29,19 +31,26 @@

invalidateIndex() {
invalidateIndex(): void {
this.treeManager = undefined;
}
invalidateBounds(): void {
this.cachedBounds = undefined;
}
getBounds(): Bounds {
if (this.clipRegion) {
const {minX: clipMinX, minY: clipMinY, maxX: clipMaxX, maxY: clipMaxY} = this.clipRegion;
const {minX, minY, maxX, maxY} = super.getBounds();
return {
minX: Math.max(minX, clipMinX),
minY: Math.max(minY, clipMinY),
maxX: Math.min(maxX, clipMaxX),
maxY: Math.min(maxY, clipMaxY)
};
} else {
return super.getBounds();
if (!this.cachedBounds) {
if (this.clipRegion) {
const {minX: clipMinX, minY: clipMinY, maxX: clipMaxX, maxY: clipMaxY} = this.clipRegion;
const {minX, minY, maxX, maxY} = super.getBounds();
this.cachedBounds = {
minX: Math.max(minX, clipMinX),
minY: Math.max(minY, clipMinY),
maxX: Math.min(maxX, clipMaxX),
maxY: Math.min(maxY, clipMaxY)
};
} else {
this.cachedBounds = super.getBounds();
}
}
return this.cachedBounds;
}

@@ -48,0 +57,0 @@

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