Make Closepath Icons Work
This commit is contained in:
parent
dab8e5daa1
commit
f84b4370fa
|
@ -1,15 +1,15 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg">
|
<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">
|
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<defs>
|
<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"/>
|
<path d="m0,0l10,5l-10,5l5,-5l-5,-5z" fill="#f00"/>
|
||||||
</marker>
|
</marker>
|
||||||
</defs>
|
</defs>
|
||||||
<g>
|
<g>
|
||||||
<title>Layer 1</title>
|
<title>Layer 1</title>
|
||||||
<path stroke="#000" stroke-width="15" fill="#ffc8c8" d="m121.5,40l-84,106l27,115l166,2l29,-111"/>
|
<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">
|
<g stroke-width="15" stroke="#00f" fill="#00ffff">
|
||||||
<circle r="30" cy="41" cx="123"/>
|
<circle r="30" cy="41" cx="123"/>
|
||||||
<circle r="30" cy="146" cx="40"/>
|
<circle r="30" cy="146" cx="40"/>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</g>
|
</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">
|
<svg viewBox="0 0 300 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<g>
|
<g>
|
||||||
<title>Layer 1</title>
|
<title>Layer 1</title>
|
||||||
|
@ -40,4 +40,6 @@
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<g id="svg_eof"/>
|
||||||
</svg>
|
</svg>
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
|
@ -14,8 +14,11 @@ $(function() {
|
||||||
var selElems,
|
var selElems,
|
||||||
updateButton = function(path) {
|
updateButton = function(path) {
|
||||||
var seglist = path.pathSegList,
|
var seglist = path.pathSegList,
|
||||||
button = $('#closepath_panel > div.tool_button')[0];
|
closed = seglist.getItem(seglist.numberOfItems - 1).pathSegType==1,
|
||||||
$(button).html(seglist.getItem(seglist.numberOfItems - 1).pathSegType==1 ? "open":"close");
|
showbutton = closed ? '#tool_openpath' : '#tool_closepath',
|
||||||
|
hidebutton = closed ? '#tool_closepath' : '#tool_openpath';
|
||||||
|
$(hidebutton).hide();
|
||||||
|
$(showbutton).show();
|
||||||
},
|
},
|
||||||
showPanel = function(on) {
|
showPanel = function(on) {
|
||||||
$('#closepath_panel').toggle(on);
|
$('#closepath_panel').toggle(on);
|
||||||
|
@ -44,12 +47,27 @@ $(function() {
|
||||||
return {
|
return {
|
||||||
name: "ClosePath",
|
name: "ClosePath",
|
||||||
svgicons: "extensions/closepath_icons.svg",
|
svgicons: "extensions/closepath_icons.svg",
|
||||||
context_tools: [{
|
buttons: [{
|
||||||
type: "tool_button",
|
id: "tool_openpath",
|
||||||
|
type: "context",
|
||||||
panel: "closepath_panel",
|
panel: "closepath_panel",
|
||||||
title: "Open or Close path",
|
title: "Open path",
|
||||||
id: "close",
|
events: {
|
||||||
events: { click: toggleClosed }
|
'click': function() {
|
||||||
|
toggleClosed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "tool_closepath",
|
||||||
|
type: "context",
|
||||||
|
panel: "closepath_panel",
|
||||||
|
title: "Close path",
|
||||||
|
events: {
|
||||||
|
'click': function() {
|
||||||
|
toggleClosed();
|
||||||
|
}
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
callback: function() {
|
callback: function() {
|
||||||
$('#closepath_panel').hide();
|
$('#closepath_panel').hide();
|
||||||
|
@ -70,7 +88,7 @@ $(function() {
|
||||||
showPanel(false);
|
showPanel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -423,9 +423,9 @@ function svg_edit_setup() {
|
||||||
|
|
||||||
var panel = $('#' + tool.panel);
|
var panel = $('#' + tool.panel);
|
||||||
|
|
||||||
if(!panel.length) {
|
// create the panel if it doesn't exist
|
||||||
|
if(!panel.length)
|
||||||
panel = $('<div>', {id: tool.panel}).appendTo("#tools_top");
|
panel = $('<div>', {id: tool.panel}).appendTo("#tools_top");
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Allow support for other types, or adding to existing tool
|
// TODO: Allow support for other types, or adding to existing tool
|
||||||
switch (tool.type) {
|
switch (tool.type) {
|
||||||
|
@ -487,7 +487,6 @@ function svg_edit_setup() {
|
||||||
var fallback_obj = {},
|
var fallback_obj = {},
|
||||||
placement_obj = {},
|
placement_obj = {},
|
||||||
svgicons = ext.svgicons;
|
svgicons = ext.svgicons;
|
||||||
|
|
||||||
var holders = {};
|
var holders = {};
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,6 +519,9 @@ function svg_edit_setup() {
|
||||||
case 'context':
|
case 'context':
|
||||||
cls = 'tool_button';
|
cls = 'tool_button';
|
||||||
parent = "#" + btn.panel;
|
parent = "#" + btn.panel;
|
||||||
|
// create the panel if it doesn't exist
|
||||||
|
if(!$(parent).length)
|
||||||
|
$('<div>', {id: btn.panel}).appendTo("#tools_top");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,7 +529,6 @@ function svg_edit_setup() {
|
||||||
.attr("id", id)
|
.attr("id", id)
|
||||||
.attr("title", btn.title)
|
.attr("title", btn.title)
|
||||||
.addClass(cls);
|
.addClass(cls);
|
||||||
|
|
||||||
if(!btn.includeWith) {
|
if(!btn.includeWith) {
|
||||||
button.appendTo(parent);
|
button.appendTo(parent);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1823,7 +1824,7 @@ function svg_edit_setup() {
|
||||||
|
|
||||||
var cancelOverlays = function() {
|
var cancelOverlays = function() {
|
||||||
$('#dialog_box').hide();
|
$('#dialog_box').hide();
|
||||||
if (!editingsource && !editingforeign && !docprops) return;
|
if (!editingsource && !docprops) return;
|
||||||
|
|
||||||
if (editingsource) {
|
if (editingsource) {
|
||||||
var oldString = svgCanvas.getSvgString();
|
var oldString = svgCanvas.getSvgString();
|
||||||
|
@ -2763,7 +2764,7 @@ function svg_edit_setup() {
|
||||||
updateCanvas(true);
|
updateCanvas(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// var revnums = "svg-editor.js ($Rev: 1402 $) ";
|
// var revnums = "svg-editor.js ($Rev: 1414 $) ";
|
||||||
// revnums += svgCanvas.getVersion();
|
// revnums += svgCanvas.getVersion();
|
||||||
// $('#copyright')[0].setAttribute("title", revnums);
|
// $('#copyright')[0].setAttribute("title", revnums);
|
||||||
return svgCanvas;
|
return svgCanvas;
|
||||||
|
|
Loading…
Reference in a new issue