Skip to content
Snippets Groups Projects
Commit 5c62bc4c authored by Javier de la Rosa's avatar Javier de la Rosa
Browse files

Allowing SET_CURRENT_CANVAS_ID to receive an object with canvasID and bounds...

Allowing SET_CURRENT_CANVAS_ID to receive an object with canvasID and bounds to pan and zoom a specific canvas after navigating to it
parent 348fa3d0
No related branches found
No related tags found
No related merge requests found
...@@ -329,6 +329,11 @@ bindEvents: function() { ...@@ -329,6 +329,11 @@ bindEvents: function() {
} }
}; };
if (_this.boundsToFocusOnNextOpen) {
_this.eventEmitter.publish('fitBounds.' + _this.windowId, _this.boundsToFocusOnNextOpen);
_this.boundsToFocusOnNextOpen = null;
}
_this.osd.world.addHandler( "add-item", addItemHandler ); _this.osd.world.addHandler( "add-item", addItemHandler );
_this.osd.addHandler('zoom', $.debounce(function(){ _this.osd.addHandler('zoom', $.debounce(function(){
......
...@@ -599,6 +599,11 @@ ...@@ -599,6 +599,11 @@
_this.setBounds(); _this.setBounds();
} }
if (_this.boundsToFocusOnNextOpen) {
_this.eventEmitter.publish('fitBounds.' + _this.windowId, _this.boundsToFocusOnNextOpen);
_this.boundsToFocusOnNextOpen = null;
}
_this.addAnnotationsLayer(_this.elemAnno); _this.addAnnotationsLayer(_this.elemAnno);
// get the state before resetting it so we can get back to that state // get the state before resetting it so we can get back to that state
......
...@@ -307,7 +307,12 @@ ...@@ -307,7 +307,12 @@
})); }));
_this.events.push(_this.eventEmitter.subscribe('SET_CURRENT_CANVAS_ID.' + this.id, function(event, canvasID) { _this.events.push(_this.eventEmitter.subscribe('SET_CURRENT_CANVAS_ID.' + this.id, function(event, canvasID) {
if (typeof canvasID === "string") {
_this.setCurrentCanvasID(canvasID); _this.setCurrentCanvasID(canvasID);
} else {
_this.setNextCanvasBounds(canvasID.bounds);
_this.setCurrentCanvasID(canvasID.canvasID);
}
})); }));
_this.events.push(_this.eventEmitter.subscribe('REMOVE_CLASS.' + this.id, function(event, className) { _this.events.push(_this.eventEmitter.subscribe('REMOVE_CLASS.' + this.id, function(event, className) {
...@@ -693,6 +698,9 @@ ...@@ -693,6 +698,9 @@
}); });
} else { } else {
var view = this.focusModules.ImageView; var view = this.focusModules.ImageView;
if (this.boundsToFocusOnNextOpen) {
view.boundsToFocusOnNextOpen = this.boundsToFocusOnNextOpen;
}
view.updateImage(canvasID); view.updateImage(canvasID);
} }
this.toggleFocus('ImageView', 'ImageView'); this.toggleFocus('ImageView', 'ImageView');
...@@ -767,6 +775,12 @@ ...@@ -767,6 +775,12 @@
_this.eventEmitter.publish(('currentCanvasIDUpdated.' + _this.id), canvasID); _this.eventEmitter.publish(('currentCanvasIDUpdated.' + _this.id), canvasID);
}, },
setNextCanvasBounds: function(bounds) {
if (bounds) {
this.boundsToFocusOnNextOpen = bounds;
}
},
replaceWindow: function(newSlotAddress, newElement) { replaceWindow: function(newSlotAddress, newElement) {
this.slotAddress = newSlotAddress; this.slotAddress = newSlotAddress;
this.appendTo = newElement; this.appendTo = newElement;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment