# HG changeset patch
# User hertzhaft
# Date 1425133061 -3600
# Node ID 1705efc794987f080c23c1c745339825956f99c6
# Parent 0d1128cb6019e38b9b2a0d7955d50c495f5dd4e3
measure: reflect line colors in measure bar
diff -r 0d1128cb6019 -r 1705efc79498 webapp/src/main/webapp/jquery/jquery.digilib.measure.css
--- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.css Sat Feb 28 13:37:08 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.css Sat Feb 28 15:17:41 2015 +0100
@@ -117,13 +117,15 @@
fill: none;
}
-span#dl-measure-linecolor,
+span#dl-measure-shapecolor,
+span#dl-measure-constrcolor,
span#dl-measure-guidecolor,
span#dl-measure-selectedcolor {
display: inline-block;
- width: 4px;
+ width: 8px;
height: 16px;
vertical-align: middle;
- margin: 0px 0px 2px 4px;
+ margin: 0px 0px 2px 2px;
+ border: 1px solid darkgray;
background-color: darkgray;
-
+}
diff -r 0d1128cb6019 -r 1705efc79498 webapp/src/main/webapp/jquery/jquery.digilib.measure.js
--- a/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Sat Feb 28 13:37:08 2015 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.measure.js Sat Feb 28 15:17:41 2015 +0100
@@ -745,6 +745,8 @@
}
}
},
+ // implemented styles
+ implementedStyles : ['shape', 'constr', 'guide', 'selected'],
// implemented measuring shape types, for select widget
implementedShapes : ['Line', 'LineString', 'Proportion', 'Rect', 'Rectangle', 'Polygon', 'Circle', 'Ellipse', 'Oval', 'Grid'],
// all measuring shape types
@@ -758,7 +760,7 @@
Polygon : { name : 'polygon', display : 'area' },
Circle : { name : 'circle', display : 'radius' },
Ellipse : { name : 'ellipse', display : 'area' },
- Oval : { name : 'oval', display : 'axis' },
+ Oval : { name : 'oval', display : 'distance' },
Grid : { name : 'linegrid', display : 'spacing' }
},
// currently selected shape type
@@ -1077,23 +1079,32 @@
// update Line Style classes (overwrite CSS)
var updateLineStyles = function(data) {
- var styles = data.settings.styles;
- var $lineStyles = data.settings.$lineStyles;
+ var s = data.settings;
+ var $lineStyles = s.$lineStyles;
+ var style = s.styles;
$lineStyles.html(
- '.'+CSS+'guide {stroke: '+styles.guide.stroke+'} '+
- '.'+CSS+'constr {stroke: '+styles.constr.stroke+'} '+
- '.'+CSS+'selected {stroke: '+styles.selected.stroke+'}'
+ '.'+CSS+'guide {stroke: '+style.guide.stroke+'} '+
+ '.'+CSS+'constr {stroke: '+style.constr.stroke+'} '+
+ '.'+CSS+'selected {stroke: '+style.selected.stroke+'}'
);
+ var widget = data.measureWidgets;
+ var styleName = s.implementedStyles;
+ var bg = 'background-color';
+ var setColor = function(i, item) {
+ widget[item+'color'].css(bg, style[item].stroke)
+ };
+ $.each(styleName, setColor);
};
// load shape types into select element
var populateShapeSelect = function(data) {
var $shape = data.measureWidgets.shape;
var shapeInfo = data.settings.shapeInfo;
+ var implementedShape = data.settings.implementedShapes;
var addOption = function(index, type) {
$shape.append($(''));
};
- $.each(data.settings.implementedShapes, addOption);
+ $.each(implementedShape, addOption);
$shape.children()[0].selected = true;
};
@@ -1102,18 +1113,21 @@
var widgets = data.measureWidgets;
var $u1 = widgets.unit1;
var $u2 = widgets.unit2;
- var sections = data.settings.units.sections;
- $.each(sections, function(index, section) {
- var $opt = $('');
+ var section = data.settings.units.sections;
+ var addOptions = function(i, item) {
+ var $opt = $('');
$u1.append($opt);
$u2.append($opt.clone());
- $.each(section.units, function(index, unit) {
- var $opt = $('');
- $opt.data('unit', unit);
+ var unit = item.units;
+ var addOption = function(i, item) {
+ var $opt = $('');
+ $opt.data('unit', item);
$u1.append($opt);
$u2.append($opt.clone());
- });
- });
+ };
+ $.each(unit, addOption);
+ };
+ $.each(section, addOptions);
$u1.children(':not(:disabled)')[data.settings.unitFrom].selected = true;
$u2.children(':not(:disabled)')[data.settings.unitTo].selected = true;
};
@@ -1129,11 +1143,11 @@
};
// initial position of measure bar (bottom left of browser window)
- var setScreenPosition = function(data, $div) {
- if ($div == null) return;
- var h = geom.rectangle($div).height;
- var s = fn.getFullscreenRect(data);
- geom.position(10, s.height - h).adjustDiv($div);
+ var setScreenPosition = function(data, $bar) {
+ if ($bar == null) return;
+ var barH = geom.rectangle($bar).height;
+ var screenH = fn.getFullscreenRect(data).height;
+ geom.position(10, screenH - barH).adjustDiv($bar);
};
// drag measureBar around
@@ -1368,7 +1382,7 @@
'type',
'value1', 'unit1', 'eq',
'value2', 'unit2',
- 'linecolor', 'guidecolor', 'selcolor',
+ 'shapecolor', 'guidecolor', 'constrcolor', 'selectedcolor',
'move'
],
info : $(''),
@@ -1382,15 +1396,18 @@
unit1 : $(''),
unit2 : $(''),
angle : $(''),
- linecolor : $(''),
- guidecolor : $(''),
- selcolor : $(''),
+ shapecolor : $(''),
+ guidecolor : $(''),
+ constrcolor :$(''),
+ selectedcolor :$(''),
move : $('
')
};
var $measureBar = $('