Sync with SVG-edit
This commit is contained in:
parent
de3008d3e4
commit
bad5beec29
8 changed files with 386 additions and 60 deletions
|
@ -9,8 +9,7 @@
|
|||
|
||||
$(function() {
|
||||
svgCanvas.addExtension("Arrows", function(S) {
|
||||
var svgcontent = S.content,
|
||||
getElem = S.getElem,
|
||||
var svgcontent = S.svgcontent,
|
||||
addElem = S.addSvgElementFromJson,
|
||||
selElems;
|
||||
|
||||
|
@ -64,7 +63,7 @@ $(function() {
|
|||
|
||||
function addMarker(id, type) {
|
||||
// TODO: Make marker (or use?) per arrow type, since refX can be different
|
||||
var marker = getElem(id);
|
||||
var marker = S.getElem(id);
|
||||
|
||||
var pathdata = {
|
||||
se_arrow_fw: {d:"m0,0l10,5l-10,5l5,-5l-5,-5z", refx:8},
|
||||
|
@ -104,7 +103,8 @@ $(function() {
|
|||
marker.setAttribute('refX', data.refx);
|
||||
}
|
||||
|
||||
function setArrow(type) {
|
||||
function setArrow() {
|
||||
var type = this.value;
|
||||
resetMarker();
|
||||
|
||||
if(type == "none") {
|
||||
|
@ -114,7 +114,6 @@ $(function() {
|
|||
var fw_id = "se_arrow_fw";
|
||||
var bk_id = "se_arrow_bk";
|
||||
|
||||
|
||||
// Set marker on element
|
||||
var id = fw_id;
|
||||
if(type == "mid_bk") {
|
||||
|
@ -134,24 +133,29 @@ $(function() {
|
|||
S.call("changed", selElems);
|
||||
}
|
||||
|
||||
// Init code
|
||||
(function() {
|
||||
var conn_tools = $('<div id="arrow_panel">\
|
||||
<label><select id="arrow_list">\
|
||||
<option value="none">No arrow</option>\
|
||||
<option value="end">----></option>\
|
||||
<option value="start"><----</option>\
|
||||
<option value="both"><---></option>\
|
||||
<option value="mid">-->--</option>\
|
||||
<option value="mid_bk">--<--</option>\
|
||||
</select></label></div>"').hide().appendTo("#tools_top");
|
||||
$('#arrow_list').change(function() {
|
||||
setArrow(this.value);
|
||||
});
|
||||
}());
|
||||
|
||||
return {
|
||||
name: "Arrows",
|
||||
context_tools: [{
|
||||
type: "select",
|
||||
panel: "arrow_panel",
|
||||
title: "Select arrow type",
|
||||
id: "arrow_list",
|
||||
options: {
|
||||
none: "No arrow",
|
||||
end: "---->",
|
||||
start: "<----",
|
||||
both: "<--->",
|
||||
mid: "-->--",
|
||||
mid_bk: "--<--"
|
||||
},
|
||||
defval: "none",
|
||||
events: {
|
||||
change: setArrow
|
||||
}
|
||||
}],
|
||||
callback: function() {
|
||||
$('#arrow_panel').hide();
|
||||
},
|
||||
addLangData: function(lang) {
|
||||
return {
|
||||
data: lang_list[lang]
|
||||
|
@ -180,4 +184,4 @@ $(function() {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue