Make Closepath Icons Work

This commit is contained in:
Jacques Distler 2010-02-19 16:37:20 -06:00
parent dab8e5daa1
commit f84b4370fa
3 changed files with 39 additions and 18 deletions

View file

@ -1,15 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g id="close">
<g id="tool_closepath">
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<marker viewBox="0 0 10 10" id="close_arrow_fw2" refY="5" markerUnits="strokeWidth" markerWidth="5" markerHeight="5" orient="auto" refX="8">
<marker viewBox="0 0 10 10" id="close_arrow_fw256" refY="5" markerUnits="strokeWidth" markerWidth="5" markerHeight="5" orient="auto" refX="8">
<path d="m0,0l10,5l-10,5l5,-5l-5,-5z" fill="#f00"/>
</marker>
</defs>
<g>
<title>Layer 1</title>
<path stroke="#000" stroke-width="15" fill="#ffc8c8" d="m121.5,40l-84,106l27,115l166,2l29,-111"/>
<line x1="240" y1="136" x2="169.5" y2="74" stroke="#f00" stroke-width="15" fill="none" marker-end="url(#close_arrow_fw2)"/>
<line x1="240" y1="136" x2="169.5" y2="74" stroke="#f00" stroke-width="15" fill="none" marker-end="url(#close_arrow_fw256)"/>
<g stroke-width="15" stroke="#00f" fill="#00ffff">
<circle r="30" cy="41" cx="123"/>
<circle r="30" cy="146" cx="40"/>
@ -20,7 +20,7 @@
</g>
</svg>
</g>
<g id="open">
<g id="tool_openpath">
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<title>Layer 1</title>
@ -40,4 +40,6 @@
</g>
</svg>
</g>
<g id="svg_eof"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

View file

@ -14,8 +14,11 @@ $(function() {
var selElems,
updateButton = function(path) {
var seglist = path.pathSegList,
button = $('#closepath_panel > div.tool_button')[0];
$(button).html(seglist.getItem(seglist.numberOfItems - 1).pathSegType==1 ? "open":"close");
closed = seglist.getItem(seglist.numberOfItems - 1).pathSegType==1,
showbutton = closed ? '#tool_openpath' : '#tool_closepath',
hidebutton = closed ? '#tool_closepath' : '#tool_openpath';
$(hidebutton).hide();
$(showbutton).show();
},
showPanel = function(on) {
$('#closepath_panel').toggle(on);
@ -44,12 +47,27 @@ $(function() {
return {
name: "ClosePath",
svgicons: "extensions/closepath_icons.svg",
context_tools: [{
type: "tool_button",
buttons: [{
id: "tool_openpath",
type: "context",
panel: "closepath_panel",
title: "Open or Close path",
id: "close",
events: { click: toggleClosed }
title: "Open path",
events: {
'click': function() {
toggleClosed();
}
}
},
{
id: "tool_closepath",
type: "context",
panel: "closepath_panel",
title: "Close path",
events: {
'click': function() {
toggleClosed();
}
}
}],
callback: function() {
$('#closepath_panel').hide();
@ -70,7 +88,7 @@ $(function() {
showPanel(false);
}
}
},
}
};
});
});