New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zoom-image-data

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zoom-image-data - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

README.md

6

dist/index.d.ts

@@ -18,2 +18,6 @@ interface param {

cellWH?: number;
/** Split Cell */
splitCell?: boolean;
/** Split Cell Size */
splitCellSize?: number;
}

@@ -57,2 +61,4 @@ declare class ZoomImageData {

invDy: number;
splitCell: boolean;
splitCellSize: number;
constructor(param: param);

@@ -59,0 +65,0 @@ /**

24

dist/index.js

@@ -15,3 +15,3 @@ (function (factory) {

constructor(param) {
const { inData, inw, inh, outData, outw, outh, cellRatio } = param;
const { inData, inw, inh, outData, outw, outh, cellRatio, splitCell, splitCellSize } = param;
this.inData = new Uint32Array(inData);

@@ -23,2 +23,4 @@ this.inw = inw;

this.outh = outh;
this.splitCell = splitCell || false;
this.splitCellSize = splitCellSize || 2;
const cellWH = param.cellWH || 10;

@@ -42,18 +44,28 @@ this.cellRatio = cellRatio || 1;

update() {
const { inData, inw, zoomw, zoomh, cellW, cellH, outData, outw, outh, invScale, invDx, invDy, } = this;
const { inData, inw, zoomw, zoomh, cellW, cellH, outData, outw, outh, invScale, invDx, invDy, splitCell, splitCellSize, } = this;
const splitX = splitCell && (cellW / invScale) > splitCellSize;
const splitY = splitCell && (cellH / invScale) > splitCellSize;
let lr = -1;
for (let i = 0; i < outh; i++) {
let zoomr = Math.round(i * invScale + invDy);
if (zoomr < 0 || zoomr >= zoomh) {
const r = ~~(zoomr / cellH);
if (zoomr < 0 || zoomr >= zoomh ||
(splitY && lr !== r)) {
outData.fill(0, i * outw, (i + 1) * outw);
lr = r;
continue;
}
const r = ~~(zoomr / cellH);
lr = r;
let lc = -1;
for (let j = 0; j < outw; j++) {
let zoomc = Math.round(j * invScale + invDx);
let index = i * outw + j;
if (zoomc < 0 || zoomc >= zoomw) {
const c = ~~(zoomc / cellW);
if (zoomc < 0 || zoomc >= zoomw ||
(splitX && lc !== c)) {
outData[index] = 0;
lc = c;
continue;
}
const c = ~~(zoomc / cellW);
lc = c;
outData[index] = inData[r * inw + c];

@@ -60,0 +72,0 @@ }

{
"name": "zoom-image-data",
"version": "2.0.1",
"version": "2.0.2",
"description": "zoom-image-data",

@@ -16,2 +16,3 @@ "main": "dist/index.js",

],
"homepage": "https://github.com/fengqing1101/resize-imagedata#readme",
"license": "ISC",

@@ -18,0 +19,0 @@ "devDependencies": {

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