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

@behance/helicropter

Package Overview
Dependencies
Maintainers
47
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 16.0.2 to 16.0.3

.tern-port

2

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

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

@@ -168,6 +168,8 @@ import View from '@behance/beff/View';

return Object.assign({}, retVal, {
x: this._model.allowLetterboxing ? retVal.x : Math.max(0, retVal.x),
y: this._model.allowLetterboxing ? retVal.y : Math.max(0, retVal.y),
});
if (this._shouldClampBounds()) {
retVal.x = Math.max(0, retVal.x);
retVal.y = Math.max(0, retVal.y);
}
return retVal;
},

@@ -197,6 +199,10 @@

_shouldClampBounds() {
return !this._model.allowLetterboxing && !this._model.allowTransparency;
},
_getReductionRatio(scaledValues) {
let reductionRatio = 1;
if (this._model.allowLetterboxing) {
if (!this._shouldClampBounds()) {
return reductionRatio;

@@ -203,0 +209,0 @@ }

@@ -308,2 +308,42 @@ import CroppingArea from 'CroppingArea';

it('allows x/y coordinates less than 0 when letterboxing', function() {
this.croppingArea._model.allowLetterboxing = true;
spyOn(this.croppingArea, '_getImageProp').and.returnValue(20);
spyOn(this.croppingArea, '_getCropAreaProp').and.returnValue(0);
this.croppingArea._cropArea.width = 100;
this.croppingArea._cropArea.height = 50;
this.croppingArea._image = { getScaleX: () => 1.0 };
expect(this.croppingArea.getCropData()).toEqual({
x: -20,
y: -20,
width: this.croppingArea._cropArea.width,
height: this.croppingArea._cropArea.height,
scale: 1.0,
});
});
it('allows x/y coordinates less than 0 when transparency is allowed', function() {
this.croppingArea._model.allowTransparency = true;
spyOn(this.croppingArea, '_getImageProp').and.returnValue(10);
spyOn(this.croppingArea, '_getCropAreaProp').and.returnValue(0);
this.croppingArea._cropArea.width = 100;
this.croppingArea._cropArea.height = 50;
this.croppingArea._image = { getScaleX: () => 1.0 };
expect(this.croppingArea.getCropData()).toEqual({
x: -10,
y: -10,
width: this.croppingArea._cropArea.width,
height: this.croppingArea._cropArea.height,
scale: 1.0,
});
});
it('does not allow height/width less than 1', function() {

@@ -441,3 +481,16 @@ spyOn(this.croppingArea, '_getImageProp').and.returnValue(1);

});
it('does not clamp coordinates to native width/height if scaled width/height is greater than native width/height and transparency is allowed', function() {
this.croppingArea._model.allowTransparency = true;
this.croppingArea._cropArea.width = 300;
this.croppingArea._cropArea.height = 300;
expect(this.croppingArea.getDimensions()).toEqual({
x: 10,
y: 20,
width: 600,
height: 600,
});
});
});
});
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