From 0cddd739b425fe4262d6729d154052ed769d2c77 Mon Sep 17 00:00:00 2001 From: Alina Jasniewski Date: Thu, 10 Aug 2017 15:34:27 -0400 Subject: [PATCH] Lymphocyte App - maintain location and zoom level between applications --- js/annotationtools/ToolBar.js | 29 ++++++++++++++++++++++ js/annotationtoolslymph/ToolBar_Lymph.js | 31 +++++++++++++++++++++++- osdCamicroscope_Lymph.php | 1 + 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/js/annotationtools/ToolBar.js b/js/annotationtools/ToolBar.js index 517822e6a..3c6871acf 100644 --- a/js/annotationtools/ToolBar.js +++ b/js/annotationtools/ToolBar.js @@ -450,10 +450,39 @@ ToolBar.prototype.createButtons = function () { window.location.href = "/select.php"; }); + /* this.lymphbutton.on('click', function () { var tissueId = this.iid; window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId; }.bind(this)) + */ + + this.lymphbutton.on('click', function () { + var tissueId = this.iid; + var x1 = annotool.imagingHelper._viewportOrigin['x']; + var y1 = annotool.imagingHelper._viewportOrigin['y']; + var x2 = x1 + annotool.imagingHelper._viewportWidth; + var y2 = y1 + annotool.imagingHelper._viewportHeight; + var zoom = viewer.viewport.getZoom(); + + var width, height; + //get image width and height + var url = 'api/Data/getImageInfoByCaseID.php?case_id=' + tissueId; + //console.log(url); + jQuery.get(url, function (data) { + //console.log(data); + try { + this_image = JSON.parse(data); + width = this_image[0].width; + height = this_image[0].height; + var x = parseInt(((x1 + x2) / 2.0) * width); + var y = parseInt(((y1 + y2) / 2.0) * height); + window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId + "&x=" + x + "&y=" + y + "&zoom=" + zoom; + } catch (error) { + window.location.href = "/camicroscope/osdCamicroscope_Lymph.php?tissueId=" + tissueId; + } + }) + }.bind(this)) this.compositebutton.on('click', function () { this.mode = 'composite'; diff --git a/js/annotationtoolslymph/ToolBar_Lymph.js b/js/annotationtoolslymph/ToolBar_Lymph.js index b84629def..3ac110e7b 100644 --- a/js/annotationtoolslymph/ToolBar_Lymph.js +++ b/js/annotationtoolslymph/ToolBar_Lymph.js @@ -459,10 +459,39 @@ ToolBar.prototype.createButtons = function () { window.location.href = "/select.php"; }.bind(this)) + /* this.micbutton.on('click', function(){ window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + this.iid; }.bind(this)) - + */ + + + this.micbutton.on('click', function () { + var tissueId = this.iid; + var x1 = annotool.imagingHelper._viewportOrigin['x']; + var y1 = annotool.imagingHelper._viewportOrigin['y']; + var x2 = x1 + annotool.imagingHelper._viewportWidth; + var y2 = y1 + annotool.imagingHelper._viewportHeight; + var zoom = viewer.viewport.getZoom(); + var width,height; + + //get image width and height + var url = 'api/Data/getImageInfoByCaseID.php?case_id=' + tissueId; + jQuery.get(url, function (data) { + //console.log(data); + try { + this_image = JSON.parse(data); + width = this_image[0].width; + height = this_image[0].height; + var x= parseInt(((x1+x2)/2.0)*width); + var y= parseInt(((y1+y2)/2.0)*height); + window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + tissueId + "&x=" + x + "&y=" + y + "&zoom=" + zoom; + } catch (error){ + window.location.href = "/camicroscope/osdCamicroscope.php?tissueId=" + tissueId; + } + }) + }.bind(this)) + this.hidebutton.on('click', function () { this.annotools.toggleMarkups() }.bind(this)) diff --git a/osdCamicroscope_Lymph.php b/osdCamicroscope_Lymph.php index 5c55a40de..4d500f62f 100644 --- a/osdCamicroscope_Lymph.php +++ b/osdCamicroscope_Lymph.php @@ -262,6 +262,7 @@ function addOverlays() { var bound_x = ; var bound_y = ; var zoom = || viewer.viewport.getMaxZoom(); + zoom =Number(zoom); //convert zoom to number if it is string jQuery("#panel").hide(); jQuery("#weightpanel").hide();