A little more work on the closepath extension (still doesn't show SVG icons yet)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1412 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2010-02-19 16:55:08 +00:00
parent 7236577141
commit 796cee60e1
4 changed files with 76 additions and 12 deletions

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);
@@ -43,12 +46,28 @@ $(function() {
return {
name: "ClosePath",
context_tools: [{
type: "tool_button",
svgicons: "extensions/closepath-icons.svg",
buttons: [{
id: "tool_openpath",
type: "context",
panel: "closepath_panel",
title: "Open or Close path",
id: "close",
events: { mousedown: 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();