# HG changeset patch # User hertzhaft # Date 1422030677 -3600 # Node ID 97974dbf0ce0f0c78423c67ce92affd37996f4b0 # Parent bf94aaa0a2c165d0127aa95e7d19d46dfe25a5b3 better shape info on click diff -r bf94aaa0a2c1 -r 97974dbf0ce0 webapp/src/main/webapp/jquery/jquery.digilib.measure.css --- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.css Fri Jan 23 16:23:10 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.css Fri Jan 23 17:31:17 2015 +0100 @@ -19,15 +19,16 @@ width: 8em; } -div#dl-measure-toolbar select { - font-size: 100%; - width: 12em; -} - span.dl-measure-label { padding: 0px 5px; } +span#dl-measure-shapeinfo { + display: inline-block; + width: 5em; + } + + span.dl-measure-number { display: inline-block; color: lightgreen; @@ -40,12 +41,19 @@ input#dl-measure-val2, select#dl-measure-shape, select#dl-measure-unit1, select#dl-measure-unit2 { color: lightgreen; background-color: #606060; + width: 12em; + margin: 0px 2px; } -select#dl-measure-shape:focus { +select#dl-measure-shape { + width: 9em; + } + +/* select#dl-measure-shape:focus { color: black; background-color: white; } +*/ option:disabled { color: black; diff -r bf94aaa0a2c1 -r 97974dbf0ce0 webapp/src/main/webapp/jquery/jquery.digilib.measure.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Fri Jan 23 16:23:10 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Fri Jan 23 17:31:17 2015 +0100 @@ -806,7 +806,7 @@ }; var data = this; var $elem = shape.$elem; - $elem.on('mouseover.measure', shapeInfo); + $elem.on('click.measure', shapeInfo); console.debug('measure: onRenderShape', data, shape); }; @@ -878,6 +878,8 @@ var widgets = data.measureWidgets; widgets.value1.val(fn.cropFloatStr(mRound(val))); widgets.value2.val(fn.cropFloatStr(mRound(conv))); + widgets.info.text('length'); + setSelectedShape(data, shape); data.lastMeasuredValue = val; data.lastMeasuredDistance = dist; }; @@ -891,6 +893,8 @@ var widgets = data.measureWidgets; widgets.value1.val(fn.cropFloatStr(mRound(val))); widgets.value2.val(fn.cropFloatStr(mRound(conv))); + widgets.info.text('area'); + setSelectedShape(data, shape); }; // info window for rectangle @@ -898,6 +902,7 @@ var widgets = data.measureWidgets; widgets.value1.val('rect 1'); widgets.value2.val('rect 2'); + setSelectedShape(data, shape); }; // recalculate after measuring @@ -935,6 +940,18 @@ return shape; }; + // return a shape of the currently selected shape type + var setSelectedShape = function(data, shape) { + var type = shape.geometry.type; + var types = data.settings.shapeTypes; + for (var i = 0; i < types.length; i++) { + if (types[i].type === type) break; + } + if (i === types.length) i = 0; + data.settings.selectedShape = i; + data.measureWidgets.shape.val(i); + }; + // return shape type selected by user (on the toolbar) var getSelectedShapeType = function(data) { var val = data.measureWidgets.shape.val(); @@ -1009,6 +1026,7 @@ names : [ 'move', 'startb', 'shape', // 'lenlabel', 'len', 'eq1', + 'info', 'value1', 'unit1', 'eq2', 'value2', 'unit2' ], @@ -1020,6 +1038,7 @@ // eq1 : $('='), eq2 : $('='), // len : $('0.0'), + info : $('length'), fac : $(''), value1 : $(''), value2 : $(''),