Commit 6ab50000 authored by hertzhaft's avatar hertzhaft

measure: color picker for line colors

parent 062283f0
......@@ -19,6 +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.colorPicker.js"></script>
<script type="text/javascript" src="jquery.digilib.measure.js" charset="utf-8"></script>
<script type="text/javascript">
......
This diff is collapsed.
......@@ -129,3 +129,43 @@ span#dl-measure-selectedcolor {
border: 1px solid darkgray;
background-color: darkgray;
}
div.colorPicker-palette {
width: 140px;
position: absolute;
border: 1px solid grey;
border-radius: 10px;
background-color: silver;
padding: 5px;
z-index: 9999;
}
div.colorPicker_hexWrap {
width: 100%;
float:left
}
div.colorPicker_hexWrap label {
font-size: 90%;
color: #2F2F2F;
margin: 5px 2px;
width: 25%
}
div.colorPicker_hexWrap input {
font-size: 90%;
margin: 5px 2px;
padding: 0;
width: 100px;
border: 1px solid #000;
}
div.colorPicker-swatch {
height: 12px;
width: 12px;
border: 1px solid #000;
margin: 1px;
float: left;
cursor: pointer;
line-height: 12px;
}
......@@ -1298,8 +1298,6 @@
var axis1 = side1.parallel(mid0); // long axis
var maxDiam = axis0.length()-1; // maximal diameter for small circles
var handle = axis1.perpendicularPoint(p[3]); // drag point projected on long axis
console.debug(handle.distance(mid2), maxDiam);
if (handle.distance(mid0) > axis1.length()) { // constrain handle
handle.moveTo(mid2);
} else if (handle.distance(mid2) > maxDiam) {
......@@ -1371,6 +1369,23 @@
$head.append($lineStyles);
data.settings.$lineStyles = $lineStyles;
updateLineStyles(data);
var widget = data.measureWidgets;
if ($.fn.colorPicker == null) {
return; }
var styleName = data.settings.implementedStyles;
var style = data.settings.styles;
var setupColorPicker = function(i, item) {
var changeStroke = function(color) {
style[item].stroke = color;
updateLineStyles(data);
};
var w = widget[item+'color'];
w.colorPicker({
pickerDefault : style[item].stroke,
onColorChange : changeStroke
});
};
$.each(styleName, setupColorPicker);
};
var setupMeasureBar = function(data) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment