changeset 1307:72c44a24a0d5

drag measuring bar by move icon
author hertzhaft
date Thu, 22 Jan 2015 12:21:38 +0100
parents 7a39ed403635
children be5a63e5b8ee
files webapp/src/main/webapp/jquery/img/move.png webapp/src/main/webapp/jquery/jquery-test-measure.html webapp/src/main/webapp/jquery/jquery.digilib.measure.css webapp/src/main/webapp/jquery/jquery.digilib.measure.js
diffstat 4 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
Binary file webapp/src/main/webapp/jquery/img/move.png has changed
--- a/webapp/src/main/webapp/jquery/jquery-test-measure.html	Fri Jan 16 20:57:20 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery-test-measure.html	Thu Jan 22 12:21:38 2015 +0100
@@ -19,7 +19,7 @@
         <link rel="stylesheet" type="text/css" href="jquery.digilib.css"></link>
         <link rel="stylesheet" type="text/css" href="jquery.digilib.measure.css"></link>
         <script type="text/javascript" src="jquery.digilib.vector.js"></script>
-        <script type="text/javascript" src="jquery.digilib.measure.js"></script>
+        <script type="text/javascript" src="jquery.digilib.measure.js" charset="utf-8"></script>
 
         <script type="text/javascript">
             $(document).ready(function(){
--- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.css	Fri Jan 16 20:57:20 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.css	Thu Jan 22 12:21:38 2015 +0100
@@ -55,3 +55,8 @@
 option.dl-units {
     margin-left: 10px;
 }
+
+img#dl-measure-move {
+    vertical-align: middle;
+    margin: 0px 4px 4px 0px;
+}
--- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.js	Fri Jan 16 20:57:20 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.js	Thu Jan 22 12:21:38 2015 +0100
@@ -903,7 +903,7 @@
 
     // drag measureBar around
     var dragMeasureBar = function(event) {
-        var $t = $(this);
+        var $t = $(this).parent();
         var x = $t.offset().left - event.pageX;
         var y = $t.offset().top - event.pageY;
         $(document.body).on('mousemove.measure', function(event) {
@@ -914,7 +914,7 @@
         }).on('mouseup.measure', function(event) {
             $(document.body).off('mousemove.measure').off('mouseup.measure');
             });
-        return true;
+        return false;
         };
 
     // setup a div for accessing the measure functionality
@@ -922,11 +922,12 @@
         console.debug('measure: setupMeasureBar');
         var measureWidgets = {
             names : [
-                'draw', 'shape',
+                'move', 'draw', 'shape',
                 'lenlabel', 'len',
                 'eq1', 'value1', 'unit1',
                 'eq2', 'value2', 'unit2'
                 ],
+            move : $('<img id="dl-measure-move" src="img/move.png" title="move measuring bar around the screen"></img>'),
             draw : $('<button id="dl-measure-draw" title="click to draw a measuring shape on top of the image">M</button>'),
             shape : $('<select id="dl-measure-shape" title="select a shape to use for measuring" />'),
 			lenlabel : $('<span class="dl-measure-label" >len</span>'),
@@ -952,7 +953,7 @@
         loadShapeTypes(data);
         loadSections(data);
         setupMeasureWidgets(data);
-        $measureBar.on('mousedown.measure', dragMeasureBar);
+        measureWidgets.move.on('mousedown.measure', dragMeasureBar);
         return $measureBar;
         };