diff --git a/editor/extensions/closepath_icons.svg b/editor/extensions/closepath_icons.svg new file mode 100644 index 00000000..f33f6be7 --- /dev/null +++ b/editor/extensions/closepath_icons.svg @@ -0,0 +1,44 @@ + + + + + + + + + + Layer 1 + + + + + + + + + + + + + + + + Layer 1 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/editor/extensions/ext-closepath.js b/editor/extensions/ext-closepath.js index 2f943d02..28afd61c 100644 --- a/editor/extensions/ext-closepath.js +++ b/editor/extensions/ext-closepath.js @@ -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(); diff --git a/editor/svg-editor.html b/editor/svg-editor.html index c3d8fb05..01b1b504 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -21,7 +21,7 @@ - +