From 81d7c9f631aee1fca949a53a3215aa6028b6e4c7 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Thu, 1 Apr 2010 20:20:24 +0000 Subject: [PATCH] Added support for stroke-linecap git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1498 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.css | 1 + editor/svg-editor.html | 11 +++++++++++ editor/svg-editor.js | 6 ++++++ editor/svgcanvas.js | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/editor/svg-editor.css b/editor/svg-editor.css index 1caaef9d..0b905bb2 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -710,6 +710,7 @@ span.zoom_tool { .stroke_tool { display: none; + white-space: nowrap; } .color_tool > *:first-child { diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 7f877458..481de02c 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -440,13 +440,24 @@ script type="text/javascript" src="locale/locale.min.js"> + + +
>> diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 0f695ffe..45c253cc 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -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();}); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 3fb1bc02..54073eec 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -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"