Added support for stroke-linecap

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1498 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-04-01 20:20:24 +00:00
parent 753270d730
commit 81d7c9f631
4 changed files with 24 additions and 0 deletions

View File

@ -710,6 +710,7 @@ span.zoom_tool {
.stroke_tool {
display: none;
white-space: nowrap;
}
.color_tool > *:first-child {

View File

@ -440,13 +440,24 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
</select>
</label>
<!-- TODO: Turn these into icon lists, rather than text ones -->
<label class="stroke_tool">
<span>Joins:</span>
<select id="stroke_linejoin" title="Change Linejoin type">
<option id="linejoin_miter" selected="selected" value="miter">Miter</option>
<option id="linejoin_round" value="round">Round</option>
<option id="linejoin_bevel" value="bevel">Bevel</option>
</select>
</label>
<label class="stroke_tool">
<span>Caps:</span>
<select id="stroke_linecap" title="Change Linecap type">
<option id="linecap_butt" selected="selected" value="butt">Butt</option>
<option id="linecap_round" value="round">Round</option>
<option id="linecap_square" value="square">Square</option>
</select>
</label>
<div id="toggle_stroke_tools" title="Show/hide more stroke tools">
&gt;&gt;

View File

@ -1016,6 +1016,7 @@
$('#stroke_width').val(selectedElement.getAttribute("stroke-width")||1);
$('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none");
$('#stroke_linejoin').val(selectedElement.getAttribute("stroke-linejoin")||"miter");
$('#stroke_linecap').val(selectedElement.getAttribute("stroke-linecap")||"butt");
}
// All elements including image and group have opacity
@ -1296,6 +1297,11 @@
operaRepaint();
});
$('#stroke_linecap').change(function(){
svgCanvas.setStrokeAttr('stroke-linecap', $(this).val());
operaRepaint();
});
// Lose focus for select elements when changed (Allows keyboard shortcuts to work better)
$('select').change(function(){$(this).blur();});

View File

@ -1144,6 +1144,7 @@ function BatchCommand(text) {
'stroke':'none',
'stroke-dasharray':'none',
'stroke-linejoin':'miter',
'stroke-linecap':'butt',
'stroke-opacity':1,
'stroke-width':1,
'rx':0,
@ -1179,6 +1180,7 @@ function BatchCommand(text) {
"stroke-width": cur_shape.stroke_width,
"stroke-dasharray": cur_shape.stroke_dasharray,
"stroke-linejoin": cur_shape.stroke_linejoin,
"stroke-linecap": cur_shape.stroke_linecap,
"stroke-opacity": cur_shape.stroke_opacity,
"fill-opacity": cur_shape.fill_opacity,
"opacity": cur_shape.opacity / 2,
@ -1227,6 +1229,7 @@ function BatchCommand(text) {
stroke_width: curConfig.initStroke.width,
stroke_dasharray: 'none',
stroke_linejoin: 'miter',
stroke_linecap: 'butt',
opacity: curConfig.initOpacity
}
};
@ -3092,6 +3095,7 @@ function BatchCommand(text) {
"stroke-width": stroke_w,
"stroke-dasharray": cur_shape.stroke_dasharray,
"stroke-linejoin": cur_shape.stroke_linejoin,
"stroke-linecap": cur_shape.stroke_linecap,
"stroke-opacity": cur_shape.stroke_opacity,
"fill": "none",
"opacity": cur_shape.opacity / 2,
@ -3522,6 +3526,7 @@ function BatchCommand(text) {
cur_properties.stroke_width = selected.getAttribute("stroke-width");
cur_properties.stroke_dasharray = selected.getAttribute("stroke-dasharray");
cur_properties.stroke_linejoin = selected.getAttribute("stroke-linejoin");
cur_properties.stroke_linecap = selected.getAttribute("stroke-linecap");
}
if (selected.tagName == "text") {
cur_text.font_size = selected.getAttribute("font-size");
@ -5594,6 +5599,7 @@ function BatchCommand(text) {
"stroke-width": cur_shape.stroke_width,
"stroke-dasharray": cur_shape.stroke_dasharray,
"stroke-linejoin": cur_shape.stroke_linejoin,
"stroke-linecap": cur_shape.stroke_linecap,
"stroke-opacity": cur_shape.stroke_opacity,
"opacity": cur_shape.opacity,
"visibility":"hidden"