@behance/helicropter
Advanced tools
Comparing version 15.5.4 to 15.5.5
{ | ||
"name": "@behance/helicropter", | ||
"version": "15.5.4", | ||
"version": "15.5.5", | ||
"description": "My helicropter goes \"whosh whosh whosh\"", | ||
@@ -5,0 +5,0 @@ "main": "src/js/index.js", |
@@ -201,4 +201,4 @@ import View from '@behance/beff/View'; | ||
if (!boundRect.width || !boundRect.height) { | ||
width = parseInt(this.$cropperCanvas.width()) * scale; | ||
height = parseInt(this.$cropperCanvas.height()) * scale; | ||
width = Number(this.$cropperCanvas.width()) * scale; | ||
height = Number(this.$cropperCanvas.height()) * scale; | ||
} | ||
@@ -205,0 +205,0 @@ |
@@ -219,2 +219,3 @@ import extend from '@behance/nbd/util/extend'; | ||
this._croppingArea.relay(this, 'scale-view'); | ||
this._uploadArea.relay(this, 'scale-view'); | ||
this._zoomSlider.relay(this._croppingArea, 'image-loaded set-crop-size'); | ||
@@ -231,6 +232,2 @@ | ||
}, | ||
'cropper-set-image'() { | ||
this._initScaleView(); | ||
}, | ||
}); | ||
@@ -243,2 +240,3 @@ | ||
this._hideError(); | ||
this._initScaleView(); | ||
}, | ||
@@ -440,2 +438,3 @@ | ||
this.render($context); | ||
this._initScaleView(); | ||
}, | ||
@@ -442,0 +441,0 @@ }); |
@@ -168,2 +168,14 @@ import Spinner from 'spin.js'; | ||
_bind() { | ||
this.listenOnce(this, { | ||
'scale-view'({ scale }) { | ||
const width = Number(this._$container.width()) * scale; | ||
const height = Number(this._$container.height()) * scale; | ||
this._$container.css({ | ||
width, | ||
height, | ||
}); | ||
}, | ||
}); | ||
this.listenTo(this._uploader, { | ||
@@ -170,0 +182,0 @@ submit({ file }) { |
@@ -377,3 +377,3 @@ import $ from 'jquery'; | ||
this.helicropter.render($('#jasmine-fixtures')); | ||
this.helicropter._view._croppingArea.trigger('cropper-set-image'); | ||
this.helicropter._view._uploadArea.trigger('image-uploading'); | ||
@@ -411,3 +411,3 @@ const $cropper = this.helicropter._view._croppingArea.$canvasContainer; | ||
}); | ||
this.helicropter._view._croppingArea.trigger('cropper-set-image'); | ||
this.helicropter._view._uploadArea.trigger('image-uploading'); | ||
@@ -429,3 +429,3 @@ this.helicropter._view.on('scale-view', done); | ||
this.helicropter.render($('#jasmine-fixtures')); | ||
this.helicropter._view._croppingArea.trigger('cropper-set-image'); | ||
this.helicropter._view._uploadArea.trigger('image-uploading'); | ||
@@ -432,0 +432,0 @@ const $cropper = this.helicropter._view._croppingArea.$canvasContainer; |
@@ -83,2 +83,22 @@ import $ from 'jquery'; | ||
it('scales _$container on "scale-view"', function() { | ||
const scale = .5; | ||
const width = 100; | ||
const height = 200; | ||
const expectedWidth = width * scale; | ||
const expectedHeight = height * scale; | ||
this.uploadArea = this.create(); | ||
this.uploadArea._$container.css({ | ||
width, | ||
height, | ||
}); | ||
this.uploadArea.trigger('scale-view', { scale }); | ||
expect(parseInt(this.uploadArea._$container.css('width'))).toEqual(expectedWidth); | ||
expect(parseInt(this.uploadArea._$container.css('height'))).toEqual(expectedHeight); | ||
}); | ||
describe('loaderStyle', function() { | ||
@@ -85,0 +105,0 @@ describe('progressbar', function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8686887
4646
44