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

@behance/helicropter

Package Overview
Dependencies
Maintainers
43
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@behance/helicropter - npm Package Compare versions

Comparing version 15.1.0 to 15.1.1

2

package.json
{
"name": "@behance/helicropter",
"version": "15.1.0",
"version": "15.1.1",
"description": "My helicropter goes \"whosh whosh whosh\"",

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

@@ -310,2 +310,5 @@ import extend from '@behance/nbd/util/extend';

this._canvas = document.createElement('canvas');
this._ctx = this._canvas.getContext('2d');
this.relay(this._view, 'controls:enabled controls:disabled image:uploading image:uploaded image:loaded error:upload');

@@ -319,9 +322,6 @@ },

getCroppedImage({ width, height }) {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
this._canvas.width = width;
this._canvas.height = height;
const ctx = canvas.getContext('2d');
const cropData = this.crop();
const image = new Image;

@@ -331,8 +331,8 @@

image.onload = () => {
ctx.drawImage(
this._ctx.drawImage(
image,
cropData.dimensions.x,
cropData.dimensions.y,
width,
height,
cropData.dimensions.width,
cropData.dimensions.height,
0,

@@ -344,3 +344,3 @@ 0,

resolve(canvas.toDataURL('image/png'));
resolve(this._canvas.toDataURL('image/png'));
};

@@ -347,0 +347,0 @@

@@ -157,10 +157,20 @@ import $ from 'jquery';

const x = 1;
const y = 1;
const width = 1;
const height = 1;
const scaledWidth = 5;
const scaledHeight = 10;
const src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=';
const image = new Image;
image.src = src;
const expectedArg = [x, y, scaledWidth, scaledHeight, 0, 0, width, height];
spyOn(this.helicropter, 'crop').and.returnValue({
dimensions: {
x: 1,
y: 1,
x,
y,
width: scaledWidth,
height: scaledHeight,
},

@@ -170,3 +180,10 @@ src,

spyOn(this.helicropter._ctx, 'drawImage');
this.helicropter.getCroppedImage({ width, height }).then(result => {
const args = this.helicropter._ctx.drawImage.calls.allArgs()[0].slice(1);
const imageArg = this.helicropter._ctx.drawImage.calls.allArgs()[0][0];
expect(args).toEqual(expectedArg);
expect(imageArg.src).toEqual(image.src);
expect(result).not.toEqual(src);

@@ -173,0 +190,0 @@ expect(result).toContain('data:image/png;base64');

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