Skip to content

Commit

Permalink
Reset the cropbox when the tile source changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Feb 10, 2017
1 parent 1da8a3b commit 576139d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/assets/javascripts/spotlight/crop.es6
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ export default class Crop {
setTileSource(source) {
if (source == this.tileSource) {
return;
} else if(this.previousCropBox) {
this.previousCropBox.remove();
}

if (this.iiifCropBox) {
this.iiifRegionField.val("");
}
this.tileSource = source;
this.iiifUrlField.val(source);
this.loaded = false;
Expand Down Expand Up @@ -157,6 +158,7 @@ export default class Crop {
if (!self.loaded) {
var bounds = self.cropRegion();
self.renderCropBox();
self.iiifCropper.invalidateSize();
self.iiifCropper.panTo(bounds.getCenter());
self.iiifCropBox.setBounds(bounds);
self.iiifCropBox.editor.editLayer.clearLayers();
Expand Down

0 comments on commit 576139d

Please sign in to comment.