new color picker
parent
05904be7c1
commit
b8b17dd84b
|
@ -22,7 +22,6 @@ html, body {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
|
@ -275,29 +274,46 @@ html, body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
div#palette_holder {
|
||||
#palette {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
height: 31px;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
width: 400px;
|
||||
right: 145px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.palette_item {
|
||||
height: 20%;
|
||||
width: 5.4%;
|
||||
float: left;
|
||||
cursor: url(images/eyedropper.png) 0 16, crosshair;
|
||||
}
|
||||
|
||||
.touch div#palette_holder {
|
||||
height: 40px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item:first-child {
|
||||
.palette_item.transparent, .palette_item.white, .palette_item.black {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: -10px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item {
|
||||
cursor: pointer;
|
||||
.palette_item.transparent {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==);
|
||||
}
|
||||
|
||||
.palette_item.black {
|
||||
background: #000;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.palette_item.white {
|
||||
background: #fff;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
#color_tools {
|
||||
position: relative;
|
||||
|
@ -426,7 +442,6 @@ html, body {
|
|||
left: 1px;
|
||||
bottom: 1px;
|
||||
right: 1px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg, .touch #color_tools #tool_stroke .color_block #stroke_bg {
|
||||
|
@ -520,11 +535,6 @@ html, body {
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
div#palette {
|
||||
float: left;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
div#workarea {
|
||||
display: inline-table-cell;
|
||||
position:absolute;
|
||||
|
@ -546,20 +556,6 @@ html, body {
|
|||
top: 40px;
|
||||
}
|
||||
|
||||
div.palette_item {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.touch div.palette_item {
|
||||
height: 30px;
|
||||
border-top: solid #2f2f2c 5px;
|
||||
border-bottom: solid #2f2f2c 5px;
|
||||
width: 19px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.menu .menu_list {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -2018,8 +2014,11 @@ input[readonly=readonly]:focus {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
#color_canvas_tools, #fill_bg, #stroke_bg {
|
||||
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
margin: 23px 5px 5px 5px;
|
||||
|
|
|
@ -571,7 +571,7 @@
|
|||
</div>
|
||||
|
||||
<div id="tools_bottom_3">
|
||||
<div id="palette_holder"><div id="palette" title="Click to change fill color, shift-click to change stroke color"></div></div>
|
||||
<div id="palette" title="Click to change fill color, shift-click to change stroke color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -267,8 +267,7 @@
|
|||
'#tool_alignmiddle, #tool_posmiddle':'align_middle',
|
||||
'#tool_alignbottom, #tool_posbottom':'align_bottom',
|
||||
'#cur_position':'align',
|
||||
'#zoomLabel':'zoom',
|
||||
'#palette .palette_item:first, #fill_bg, #stroke_bg':'no_color'
|
||||
'#zoomLabel':'zoom'
|
||||
},
|
||||
resize: {
|
||||
'#logo .svg_icon': 15,
|
||||
|
@ -331,15 +330,29 @@
|
|||
Editor.canvas = svgCanvas = new $.SvgCanvas(document.getElementById("svgcanvas"), curConfig);
|
||||
Editor.show_save_warning = false;
|
||||
Editor.paintBox = {fill: null, stroke:null, canvas:null};
|
||||
var palette = ["#000000", "#3f3f3f", "#7f7f7f", "#bfbfbf", "#ffffff",
|
||||
"#ff0000", "#ff7f00", "#ffff00", "#7fff00",
|
||||
"#00ff00", "#00ff7f", "#00ffff", "#007fff",
|
||||
"#0000ff", "#7f00ff", "#ff00ff", "#ff007f",
|
||||
"#7f0000", "#7f3f00", "#7f7f00", "#3f7f00",
|
||||
"#007f00", "#007f3f", "#007f7f", "#003f7f",
|
||||
"#00007f", "#3f007f", "#7f007f", "#7f003f",
|
||||
"#ffaaaa", "#ffd4aa", "#ffffaa", "#d4ffaa",
|
||||
"#aaffaa", "#aaffd4", "#aaffff", "#aad4ff"
|
||||
var palette = ["#482816", "#422C10", "#3B2F0E", "#32320F",
|
||||
"#293414", "#1F361B", "#153723", "#0C372C",
|
||||
"#083734", "#0E353B", "#1A333F", "#273141",
|
||||
"#332D40", "#3E2A3C", "#462735", "#4B252D",
|
||||
"#4D2425", "#4C261D", "#845335", "#7B572D",
|
||||
"#6F5C2A", "#62612C", "#546433", "#46673D",
|
||||
"#396849", "#306856", "#2D6862", "#33666C",
|
||||
"#426373", "#535F75", "#645A73", "#74556D",
|
||||
"#805064", "#884D58", "#8B4D4B", "#894F3F",
|
||||
"#C48157", "#B8874D", "#A98E49", "#97944B",
|
||||
"#849854", "#729C62", "#619E73", "#559E84",
|
||||
"#529D94", "#5B9BA2", "#6D97AB", "#8391AE",
|
||||
"#9A8AAB", "#AF84A3", "#BF7E96", "#C97A86",
|
||||
"#CE7975", "#CC7C65", "#FFB27C", "#FABA6F",
|
||||
"#E6C36A", "#CFCA6D", "#B8D078", "#A0D58A",
|
||||
"#8CD79F", "#7DD8B5", "#7AD6CA", "#84D3DB",
|
||||
"#9ACEE6", "#B6C7EA", "#D3BEE7", "#EDB6DC",
|
||||
"#FFAFCC", "#FFAAB8", "#FFA9A2", "#FFAC8D",
|
||||
"#FFE7A2", "#FFF093", "#FFFA8D", "#FFFF91",
|
||||
"#EEFF9F", "#D1FFB4", "#B9FFCE", "#A8FFE9",
|
||||
"#A4FFFF", "#B1FFFF", "#CBFFFF", "#EDFFFF",
|
||||
"#FFF5FF", "#FFEBFF", "#FFE2FF", "#FFDCEC",
|
||||
"#FFDBD2", "#FFDFB8"
|
||||
],
|
||||
isMac = (navigator.platform.indexOf("Mac") >= 0),
|
||||
isWebkit = (navigator.userAgent.indexOf("AppleWebKit") >= 0),
|
||||
|
@ -1627,8 +1640,10 @@
|
|||
svgCanvas.bind("extension_added", extAdded);
|
||||
svgCanvas.textActions.setInputElem($("#text")[0]);
|
||||
|
||||
var str = '<div class="palette_item" data-rgb="none"></div>'
|
||||
$.each(palette, function(i,item){
|
||||
var str = '<div class="palette_item transparent" data-rgb="none"></div>\
|
||||
<div class="palette_item black" data-rgb="#000000"></div>\
|
||||
<div class="palette_item white" data-rgb="#ffffff"></div>'
|
||||
palette.forEach(function(item, i){
|
||||
str += '<div class="palette_item" style="background-color: ' + item + ';" data-rgb="' + item + '"></div>';
|
||||
});
|
||||
$('#palette').append(str);
|
||||
|
@ -1733,19 +1748,20 @@
|
|||
svgCanvas.changeSelectedAttributeNoUndo(attr, val);
|
||||
};
|
||||
|
||||
// Prevent selection of elements when shift-clicking
|
||||
$('#palette').mouseover(function() {
|
||||
var inp = $('<input type="hidden">');
|
||||
$(this).append(inp);
|
||||
inp.focus().remove();
|
||||
});
|
||||
picking = false;
|
||||
$(document).on("mouseup", function(){picking = false;})
|
||||
|
||||
$('.palette_item').on("mousedown touchstart touchmove", function(evt){
|
||||
$('#palette').on("mousemove mousedown touchstart touchmove", ".palette_item", function(evt){
|
||||
evt.preventDefault();
|
||||
|
||||
if (evt.type == "mousedown") picking = true;
|
||||
if (picking) {
|
||||
var isStroke = $('#tool_stroke').hasClass('active');
|
||||
var picker = isStroke ? "stroke" : "fill";
|
||||
var color = $(this).attr('data-rgb');
|
||||
var paint = null;
|
||||
|
||||
var noUndo = true;
|
||||
if (evt.type == "mousedown") noUndo = false
|
||||
// Webkit-based browsers returned 'initial' here for no stroke
|
||||
if (color === 'transparent' || color === 'initial' || color === '#none') {
|
||||
color = 'none';
|
||||
|
@ -1758,16 +1774,17 @@
|
|||
Editor.paintBox[picker].setPaint(paint);
|
||||
|
||||
if (isStroke) {
|
||||
svgCanvas.setColor('stroke', color);
|
||||
svgCanvas.setColor('stroke', color, noUndo);
|
||||
if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('stroke', 1.0);
|
||||
}
|
||||
} else {
|
||||
svgCanvas.setColor('fill', color);
|
||||
svgCanvas.setColor('fill', color, noUndo);
|
||||
if (color != 'none' && svgCanvas.getFillOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('fill', 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).bind('contextmenu', function(e) {e.preventDefault()});
|
||||
|
||||
$("#toggle_stroke_tools").toggle(function() {
|
||||
|
@ -2855,7 +2872,7 @@
|
|||
this.paint = new $.jGraduate.Paint({solidColor: cur.color});
|
||||
this.type = type;
|
||||
|
||||
this.setPaint = function(paint, apply) {
|
||||
this.setPaint = function(paint, apply, noUndo) {
|
||||
this.paint = paint;
|
||||
var fillAttr = "none";
|
||||
var ptype = paint.type;
|
||||
|
@ -2938,7 +2955,6 @@
|
|||
var defColor = type === "fill" ? "black" : "none";
|
||||
var paintColor = selectedElement.getAttribute(type) || defColor;
|
||||
}
|
||||
|
||||
if(apply) {
|
||||
svgCanvas.setColor(type, paintColor, true);
|
||||
svgCanvas.setPaintOpacity(type, paintOpacity, true);
|
||||
|
|
|
@ -130,10 +130,12 @@ html,body{overflow:hidden;width:100%;height:100%}
|
|||
#ruler_x canvas{float:left}
|
||||
#ruler_y canvas{margin-top:-16px}
|
||||
#ruler_x>div,#ruler_y>div{overflow:hidden}
|
||||
div#palette_holder{display:block;overflow:hidden;height:31px;margin-top:10px;position:relative;z-index:2;float:left}
|
||||
.touch div#palette_holder{height:40px;margin-top:0}
|
||||
div#palette_holder #palette .palette_item:first-child{background:#fff}
|
||||
div#palette_holder #palette .palette_item{cursor:pointer}
|
||||
#palette{display:block;position:absolute;z-index:2;left:10px;bottom:5px;width:400px;right:145px;height:30px}
|
||||
.palette_item{height:20%;width:5.4%;float:left;cursor:url(images/eyedropper.png) 0 16,crosshair}
|
||||
.palette_item.transparent,.palette_item.white,.palette_item.black{background:#fff;position:absolute;width:10px;height:10px;left:-10px;top:0}
|
||||
.palette_item.transparent{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==)}
|
||||
.palette_item.black{background:#000;top:10px}
|
||||
.palette_item.white{background:#fff;top:20px}
|
||||
#color_tools{position:relative;width:48px;height:48px;margin:6px 6px 0 6px}
|
||||
.touch #color_tools{width:auto;height:auto}
|
||||
#tool_fill{position:absolute;top:0;left:0;z-index:1}
|
||||
|
@ -155,7 +157,7 @@ div#palette_holder #palette .palette_item{cursor:pointer}
|
|||
#color_tools #tool_fill .color_block:hover,#color_tools #tool_stroke .color_block:hover{border-color:#fff}
|
||||
#color_tools #tool_fill .color_block>div{position:absolute;top:0;left:0}
|
||||
.touch #color_tools #tool_fill .color_block>div{position:relative}
|
||||
#color_tools #tool_fill .color_block #fill_bg,#color_tools #tool_stroke .color_block #stroke_bg{position:absolute;top:1px;left:1px;bottom:1px;right:1px;background:#fff}
|
||||
#color_tools #tool_fill .color_block #fill_bg,#color_tools #tool_stroke .color_block #stroke_bg{position:absolute;top:1px;left:1px;bottom:1px;right:1px}
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg,.touch #color_tools #tool_stroke .color_block #stroke_bg{width:36px;height:36px;right:auto;bottom:auto}
|
||||
.touch #tool_stroke{position:relative;top:0;left:0;z-index:0}
|
||||
#stroke_color:after{content:'';position:absolute;display:block;width:8px;height:8px;left:8px;top:8px;background:#ccc;box-shadow:0 0 0 1px #000}
|
||||
|
@ -169,11 +171,8 @@ div#palette_holder #palette .palette_item{cursor:pointer}
|
|||
.touch #color_tools #tool_stroke .color_block>div{position:relative}
|
||||
#color_tools .icon_label{padding:0;width:24px;height:100%;cursor:pointer;position:absolute}
|
||||
#linkLabel>svg{height:20px;padding-top:4px}
|
||||
div#palette{float:left;height:16px}
|
||||
div#workarea{display:inline-table-cell;position:absolute;top:30px;left:50px;bottom:40px;right:175px;background-color:#444;overflow:auto;text-align:center;-webkit-transition:-webkit-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-moz-transition:-moz-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-o-transition:-o-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-ms-transition:-ms-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);transition:transform 500ms cubic-bezier(0.13,0.66,0.24,0.92)}
|
||||
.touch div#workarea{top:40px}
|
||||
div.palette_item{height:16px;width:16px;float:left}
|
||||
.touch div.palette_item{height:30px;border-top:solid #2f2f2c 5px;border-bottom:solid #2f2f2c 5px;width:19px;float:left}
|
||||
.menu .menu_list{display:none;position:absolute}
|
||||
.tool_button:hover,.push_button:hover,.buttonup:hover,.buttondown,.tool_button_current,.push_button_pressed{background-color:#fff}
|
||||
.tool_button.disabled,.tool_button.disabled:hover{opacity:.3;background-color:#aaa}
|
||||
|
@ -403,7 +402,8 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
|
|||
body.dragging *{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
body.drag *{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
input[readonly=readonly]:focus{box-shadow:none}
|
||||
#color_canvas_tools{background:#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;width:60px;height:40px;margin:23px 5px 5px 5px;position:relative;overflow:hidden}
|
||||
#color_canvas_tools,#fill_bg,#stroke_bg{background:#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat}
|
||||
#color_canvas_tools{width:60px;height:40px;margin:23px 5px 5px 5px;position:relative;overflow:hidden}
|
||||
#color_canvas_tools{display:block}
|
||||
#tool_angle_indicator{width:50px;height:50px;border-radius:50px;background:rgba(255,255,255,0.05);position:absolute;bottom:2px;left:10px}
|
||||
#tool_angle_indicator_cursor{width:4px;height:25px;border-top:solid #50a0ff 3px;position:absolute;margin:0 0 0 23px;-webkit-transform-origin:50% 0;-moz-transform-origin:50% 0;-o-transform-origin:50% 0;-ms-transform-origin:50% 0;transform-origin:50% 0}
|
||||
|
|
|
@ -385,74 +385,75 @@ b.setCustomHandlers=function(c){b.ready(function(){if(c.open){a('#tool_open > in
|
|||
else if(o.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(o.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);var c=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(n){if(!n){n=document.createElement("script");n.src=curConfig.extPath+k;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(c,100):c();
|
||||
a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",
|
||||
align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath",
|
||||
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,
|
||||
"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+
|
||||
"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=
|
||||
setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var l=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",
|
||||
K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars",ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+
|
||||
'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,
|
||||
E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,
|
||||
w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()==
|
||||
"zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=
|
||||
a(ha.parent+"_show").hasClass("tool_button_current"),qa=a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",
|
||||
ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?
|
||||
200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left",fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=
|
||||
a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:
|
||||
{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};
|
||||
document.getElementById("canvas_background")||Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Fa=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();
|
||||
n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":
|
||||
"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=
|
||||
null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));
|
||||
a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={g:[],a:[],rect:["rx","width","height","x","y"],image:["width",
|
||||
"height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+
|
||||
"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,
|
||||
"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||
|
||||
H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
|
||||
function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&na();if(o==="pathedit")return Fa();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();
|
||||
break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J=w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Fa();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=
|
||||
null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",
|
||||
function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Fa();if(X&&o==="select"){b.paintBox.fill.update();
|
||||
b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done",
|
||||
"all");E="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s",
|
||||
"PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});
|
||||
g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",
|
||||
Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';
|
||||
qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);
|
||||
W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba=
|
||||
"tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?
|
||||
Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");
|
||||
a("#"+W.list+"_opts").append(Qa);if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=
|
||||
[{sel:"#"+ua,fn:W.events.click,icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+
|
||||
W.key+"]")}}else Qa.bind(Cb,Jb);else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!l,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00",
|
||||
"#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,n){Ma+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Ma);var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";
|
||||
Ga.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});
|
||||
a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),n=k?"stroke":"fill",o=a(this).attr("data-rgb"),w=null;if(o==="transparent"||o==="initial"||o==="#none"){o="none";w=new a.jGraduate.Paint}else w=new a.jGraduate.Paint({alpha:100,solidColor:o.substr(1)});b.paintBox[n].setPaint(w);
|
||||
if(k){g.setColor("stroke",o);o!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",o);o!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;
|
||||
if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type===
|
||||
"mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault();g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup",
|
||||
"alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});
|
||||
a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",
|
||||
function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");
|
||||
E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup");n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,
|
||||
arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=
|
||||
this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N=
|
||||
"canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Da=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},
|
||||
Ea=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+
|
||||
K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&
|
||||
window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Fa()}},ob=function(){X!=
|
||||
null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ca=function(k,n){if(!(X==null||U)){k||(n*=-1);
|
||||
var o=a("#angle").val()*1+n;g.setRotationAngle(o);Fa()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Fa();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Fa()},Za=function(){g.setItalic(!g.getItalic());Fa()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?
|
||||
g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},
|
||||
Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
|
||||
if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=
|
||||
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
|
||||
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);
|
||||
a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=
|
||||
/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+
|
||||
O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility",
|
||||
"visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?
|
||||
24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=
|
||||
a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);
|
||||
event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var l=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars",
|
||||
ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+
|
||||
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",
|
||||
w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});
|
||||
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a",
|
||||
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
|
||||
a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",
|
||||
V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left",
|
||||
fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
|
||||
a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},
|
||||
ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||
|
||||
Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Fa=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
|
||||
a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
|
||||
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);
|
||||
a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==
|
||||
-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
|
||||
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")===
|
||||
"true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},
|
||||
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
||||
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&
|
||||
na();if(o==="pathedit")return Fa();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J=
|
||||
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Fa();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
|
||||
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
|
||||
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Fa();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
|
||||
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
|
||||
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
|
||||
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
|
||||
la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,
|
||||
jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");
|
||||
W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,
|
||||
jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",
|
||||
{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=
|
||||
a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa);
|
||||
if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,
|
||||
icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb);
|
||||
else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!l,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>';
|
||||
["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3",
|
||||
"#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'});
|
||||
a("#palette").append(Ma);var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ga.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());
|
||||
a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||
|
||||
1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"),
|
||||
E=null,H=true;if(k.type=="mousedown")H=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,H);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,H);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
||||
"table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
|
||||
null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type==="mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault();
|
||||
g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=
|
||||
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",
|
||||
function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");
|
||||
o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup");
|
||||
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
|
||||
n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
|
||||
"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Da=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},Ea=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
|
||||
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
|
||||
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
|
||||
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Fa()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
|
||||
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
|
||||
ca=function(){g.cycleElement(0)},Ca=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Fa()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Fa();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Fa()},Za=function(){g.setItalic(!g.getItalic());Fa()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
|
||||
Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
|
||||
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
|
||||
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
|
||||
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
|
||||
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
|
||||
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
|
||||
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
|
||||
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
|
||||
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
|
||||
|
|
|
@ -604,7 +604,6 @@ html, body {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
|
@ -857,29 +856,46 @@ html, body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
div#palette_holder {
|
||||
#palette {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
height: 31px;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
width: 400px;
|
||||
right: 145px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.palette_item {
|
||||
height: 20%;
|
||||
width: 5.4%;
|
||||
float: left;
|
||||
cursor: url(images/eyedropper.png) 0 16, crosshair;
|
||||
}
|
||||
|
||||
.touch div#palette_holder {
|
||||
height: 40px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item:first-child {
|
||||
.palette_item.transparent, .palette_item.white, .palette_item.black {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: -10px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item {
|
||||
cursor: pointer;
|
||||
.palette_item.transparent {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==);
|
||||
}
|
||||
|
||||
.palette_item.black {
|
||||
background: #000;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.palette_item.white {
|
||||
background: #fff;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
#color_tools {
|
||||
position: relative;
|
||||
|
@ -1008,7 +1024,6 @@ html, body {
|
|||
left: 1px;
|
||||
bottom: 1px;
|
||||
right: 1px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg, .touch #color_tools #tool_stroke .color_block #stroke_bg {
|
||||
|
@ -1102,11 +1117,6 @@ html, body {
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
div#palette {
|
||||
float: left;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
div#workarea {
|
||||
display: inline-table-cell;
|
||||
position:absolute;
|
||||
|
@ -1128,20 +1138,6 @@ html, body {
|
|||
top: 40px;
|
||||
}
|
||||
|
||||
div.palette_item {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.touch div.palette_item {
|
||||
height: 30px;
|
||||
border-top: solid #2f2f2c 5px;
|
||||
border-bottom: solid #2f2f2c 5px;
|
||||
width: 19px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.menu .menu_list {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -2600,8 +2596,11 @@ input[readonly=readonly]:focus {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
#color_canvas_tools, #fill_bg, #stroke_bg {
|
||||
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
margin: 23px 5px 5px 5px;
|
||||
|
|
|
@ -22,7 +22,6 @@ html, body {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
|
@ -275,29 +274,46 @@ html, body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
div#palette_holder {
|
||||
#palette {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
height: 31px;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
width: 400px;
|
||||
right: 145px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.palette_item {
|
||||
height: 20%;
|
||||
width: 5.4%;
|
||||
float: left;
|
||||
cursor: url(images/eyedropper.png) 0 16, crosshair;
|
||||
}
|
||||
|
||||
.touch div#palette_holder {
|
||||
height: 40px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item:first-child {
|
||||
.palette_item.transparent, .palette_item.white, .palette_item.black {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: -10px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item {
|
||||
cursor: pointer;
|
||||
.palette_item.transparent {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==);
|
||||
}
|
||||
|
||||
.palette_item.black {
|
||||
background: #000;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.palette_item.white {
|
||||
background: #fff;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
#color_tools {
|
||||
position: relative;
|
||||
|
@ -426,7 +442,6 @@ html, body {
|
|||
left: 1px;
|
||||
bottom: 1px;
|
||||
right: 1px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg, .touch #color_tools #tool_stroke .color_block #stroke_bg {
|
||||
|
@ -520,11 +535,6 @@ html, body {
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
div#palette {
|
||||
float: left;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
div#workarea {
|
||||
display: inline-table-cell;
|
||||
position:absolute;
|
||||
|
@ -546,20 +556,6 @@ html, body {
|
|||
top: 40px;
|
||||
}
|
||||
|
||||
div.palette_item {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.touch div.palette_item {
|
||||
height: 30px;
|
||||
border-top: solid #2f2f2c 5px;
|
||||
border-bottom: solid #2f2f2c 5px;
|
||||
width: 19px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.menu .menu_list {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -2018,8 +2014,11 @@ input[readonly=readonly]:focus {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
#color_canvas_tools, #fill_bg, #stroke_bg {
|
||||
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
margin: 23px 5px 5px 5px;
|
||||
|
|
|
@ -571,7 +571,7 @@
|
|||
</div>
|
||||
|
||||
<div id="tools_bottom_3">
|
||||
<div id="palette_holder"><div id="palette" title="Click to change fill color, shift-click to change stroke color"></div></div>
|
||||
<div id="palette" title="Click to change fill color, shift-click to change stroke color"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -267,8 +267,7 @@
|
|||
'#tool_alignmiddle, #tool_posmiddle':'align_middle',
|
||||
'#tool_alignbottom, #tool_posbottom':'align_bottom',
|
||||
'#cur_position':'align',
|
||||
'#zoomLabel':'zoom',
|
||||
'#palette .palette_item:first, #fill_bg, #stroke_bg':'no_color'
|
||||
'#zoomLabel':'zoom'
|
||||
},
|
||||
resize: {
|
||||
'#logo .svg_icon': 15,
|
||||
|
@ -331,15 +330,29 @@
|
|||
Editor.canvas = svgCanvas = new $.SvgCanvas(document.getElementById("svgcanvas"), curConfig);
|
||||
Editor.show_save_warning = false;
|
||||
Editor.paintBox = {fill: null, stroke:null, canvas:null};
|
||||
var palette = ["#000000", "#3f3f3f", "#7f7f7f", "#bfbfbf", "#ffffff",
|
||||
"#ff0000", "#ff7f00", "#ffff00", "#7fff00",
|
||||
"#00ff00", "#00ff7f", "#00ffff", "#007fff",
|
||||
"#0000ff", "#7f00ff", "#ff00ff", "#ff007f",
|
||||
"#7f0000", "#7f3f00", "#7f7f00", "#3f7f00",
|
||||
"#007f00", "#007f3f", "#007f7f", "#003f7f",
|
||||
"#00007f", "#3f007f", "#7f007f", "#7f003f",
|
||||
"#ffaaaa", "#ffd4aa", "#ffffaa", "#d4ffaa",
|
||||
"#aaffaa", "#aaffd4", "#aaffff", "#aad4ff"
|
||||
var palette = ["#482816", "#422C10", "#3B2F0E", "#32320F",
|
||||
"#293414", "#1F361B", "#153723", "#0C372C",
|
||||
"#083734", "#0E353B", "#1A333F", "#273141",
|
||||
"#332D40", "#3E2A3C", "#462735", "#4B252D",
|
||||
"#4D2425", "#4C261D", "#845335", "#7B572D",
|
||||
"#6F5C2A", "#62612C", "#546433", "#46673D",
|
||||
"#396849", "#306856", "#2D6862", "#33666C",
|
||||
"#426373", "#535F75", "#645A73", "#74556D",
|
||||
"#805064", "#884D58", "#8B4D4B", "#894F3F",
|
||||
"#C48157", "#B8874D", "#A98E49", "#97944B",
|
||||
"#849854", "#729C62", "#619E73", "#559E84",
|
||||
"#529D94", "#5B9BA2", "#6D97AB", "#8391AE",
|
||||
"#9A8AAB", "#AF84A3", "#BF7E96", "#C97A86",
|
||||
"#CE7975", "#CC7C65", "#FFB27C", "#FABA6F",
|
||||
"#E6C36A", "#CFCA6D", "#B8D078", "#A0D58A",
|
||||
"#8CD79F", "#7DD8B5", "#7AD6CA", "#84D3DB",
|
||||
"#9ACEE6", "#B6C7EA", "#D3BEE7", "#EDB6DC",
|
||||
"#FFAFCC", "#FFAAB8", "#FFA9A2", "#FFAC8D",
|
||||
"#FFE7A2", "#FFF093", "#FFFA8D", "#FFFF91",
|
||||
"#EEFF9F", "#D1FFB4", "#B9FFCE", "#A8FFE9",
|
||||
"#A4FFFF", "#B1FFFF", "#CBFFFF", "#EDFFFF",
|
||||
"#FFF5FF", "#FFEBFF", "#FFE2FF", "#FFDCEC",
|
||||
"#FFDBD2", "#FFDFB8"
|
||||
],
|
||||
isMac = (navigator.platform.indexOf("Mac") >= 0),
|
||||
isWebkit = (navigator.userAgent.indexOf("AppleWebKit") >= 0),
|
||||
|
@ -1627,8 +1640,10 @@
|
|||
svgCanvas.bind("extension_added", extAdded);
|
||||
svgCanvas.textActions.setInputElem($("#text")[0]);
|
||||
|
||||
var str = '<div class="palette_item" data-rgb="none"></div>'
|
||||
$.each(palette, function(i,item){
|
||||
var str = '<div class="palette_item transparent" data-rgb="none"></div>\
|
||||
<div class="palette_item black" data-rgb="#000000"></div>\
|
||||
<div class="palette_item white" data-rgb="#ffffff"></div>'
|
||||
palette.forEach(function(item, i){
|
||||
str += '<div class="palette_item" style="background-color: ' + item + ';" data-rgb="' + item + '"></div>';
|
||||
});
|
||||
$('#palette').append(str);
|
||||
|
@ -1733,19 +1748,20 @@
|
|||
svgCanvas.changeSelectedAttributeNoUndo(attr, val);
|
||||
};
|
||||
|
||||
// Prevent selection of elements when shift-clicking
|
||||
$('#palette').mouseover(function() {
|
||||
var inp = $('<input type="hidden">');
|
||||
$(this).append(inp);
|
||||
inp.focus().remove();
|
||||
});
|
||||
picking = false;
|
||||
$(document).on("mouseup", function(){picking = false;})
|
||||
|
||||
$('.palette_item').on("mousedown touchstart touchmove", function(evt){
|
||||
$('#palette').on("mousemove mousedown touchstart touchmove", ".palette_item", function(evt){
|
||||
evt.preventDefault();
|
||||
|
||||
if (evt.type == "mousedown") picking = true;
|
||||
if (picking) {
|
||||
var isStroke = $('#tool_stroke').hasClass('active');
|
||||
var picker = isStroke ? "stroke" : "fill";
|
||||
var color = $(this).attr('data-rgb');
|
||||
var paint = null;
|
||||
|
||||
var noUndo = true;
|
||||
if (evt.type == "mousedown") noUndo = false
|
||||
// Webkit-based browsers returned 'initial' here for no stroke
|
||||
if (color === 'transparent' || color === 'initial' || color === '#none') {
|
||||
color = 'none';
|
||||
|
@ -1758,16 +1774,17 @@
|
|||
Editor.paintBox[picker].setPaint(paint);
|
||||
|
||||
if (isStroke) {
|
||||
svgCanvas.setColor('stroke', color);
|
||||
svgCanvas.setColor('stroke', color, noUndo);
|
||||
if (color != 'none' && svgCanvas.getStrokeOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('stroke', 1.0);
|
||||
}
|
||||
} else {
|
||||
svgCanvas.setColor('fill', color);
|
||||
svgCanvas.setColor('fill', color, noUndo);
|
||||
if (color != 'none' && svgCanvas.getFillOpacity() != 1) {
|
||||
svgCanvas.setPaintOpacity('fill', 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).bind('contextmenu', function(e) {e.preventDefault()});
|
||||
|
||||
$("#toggle_stroke_tools").toggle(function() {
|
||||
|
@ -2855,7 +2872,7 @@
|
|||
this.paint = new $.jGraduate.Paint({solidColor: cur.color});
|
||||
this.type = type;
|
||||
|
||||
this.setPaint = function(paint, apply) {
|
||||
this.setPaint = function(paint, apply, noUndo) {
|
||||
this.paint = paint;
|
||||
var fillAttr = "none";
|
||||
var ptype = paint.type;
|
||||
|
@ -2938,7 +2955,6 @@
|
|||
var defColor = type === "fill" ? "black" : "none";
|
||||
var paintColor = selectedElement.getAttribute(type) || defColor;
|
||||
}
|
||||
|
||||
if(apply) {
|
||||
svgCanvas.setColor(type, paintColor, true);
|
||||
svgCanvas.setPaintOpacity(type, paintOpacity, true);
|
||||
|
|
|
@ -130,10 +130,12 @@ html,body{overflow:hidden;width:100%;height:100%}
|
|||
#ruler_x canvas{float:left}
|
||||
#ruler_y canvas{margin-top:-16px}
|
||||
#ruler_x>div,#ruler_y>div{overflow:hidden}
|
||||
div#palette_holder{display:block;overflow:hidden;height:31px;margin-top:10px;position:relative;z-index:2;float:left}
|
||||
.touch div#palette_holder{height:40px;margin-top:0}
|
||||
div#palette_holder #palette .palette_item:first-child{background:#fff}
|
||||
div#palette_holder #palette .palette_item{cursor:pointer}
|
||||
#palette{display:block;position:absolute;z-index:2;left:10px;bottom:5px;width:400px;right:145px;height:30px}
|
||||
.palette_item{height:20%;width:5.4%;float:left;cursor:url(images/eyedropper.png) 0 16,crosshair}
|
||||
.palette_item.transparent,.palette_item.white,.palette_item.black{background:#fff;position:absolute;width:10px;height:10px;left:-10px;top:0}
|
||||
.palette_item.transparent{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==)}
|
||||
.palette_item.black{background:#000;top:10px}
|
||||
.palette_item.white{background:#fff;top:20px}
|
||||
#color_tools{position:relative;width:48px;height:48px;margin:6px 6px 0 6px}
|
||||
.touch #color_tools{width:auto;height:auto}
|
||||
#tool_fill{position:absolute;top:0;left:0;z-index:1}
|
||||
|
@ -155,7 +157,7 @@ div#palette_holder #palette .palette_item{cursor:pointer}
|
|||
#color_tools #tool_fill .color_block:hover,#color_tools #tool_stroke .color_block:hover{border-color:#fff}
|
||||
#color_tools #tool_fill .color_block>div{position:absolute;top:0;left:0}
|
||||
.touch #color_tools #tool_fill .color_block>div{position:relative}
|
||||
#color_tools #tool_fill .color_block #fill_bg,#color_tools #tool_stroke .color_block #stroke_bg{position:absolute;top:1px;left:1px;bottom:1px;right:1px;background:#fff}
|
||||
#color_tools #tool_fill .color_block #fill_bg,#color_tools #tool_stroke .color_block #stroke_bg{position:absolute;top:1px;left:1px;bottom:1px;right:1px}
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg,.touch #color_tools #tool_stroke .color_block #stroke_bg{width:36px;height:36px;right:auto;bottom:auto}
|
||||
.touch #tool_stroke{position:relative;top:0;left:0;z-index:0}
|
||||
#stroke_color:after{content:'';position:absolute;display:block;width:8px;height:8px;left:8px;top:8px;background:#ccc;box-shadow:0 0 0 1px #000}
|
||||
|
@ -169,11 +171,8 @@ div#palette_holder #palette .palette_item{cursor:pointer}
|
|||
.touch #color_tools #tool_stroke .color_block>div{position:relative}
|
||||
#color_tools .icon_label{padding:0;width:24px;height:100%;cursor:pointer;position:absolute}
|
||||
#linkLabel>svg{height:20px;padding-top:4px}
|
||||
div#palette{float:left;height:16px}
|
||||
div#workarea{display:inline-table-cell;position:absolute;top:30px;left:50px;bottom:40px;right:175px;background-color:#444;overflow:auto;text-align:center;-webkit-transition:-webkit-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-moz-transition:-moz-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-o-transition:-o-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);-ms-transition:-ms-transform 500ms cubic-bezier(0.13,0.66,0.24,0.92);transition:transform 500ms cubic-bezier(0.13,0.66,0.24,0.92)}
|
||||
.touch div#workarea{top:40px}
|
||||
div.palette_item{height:16px;width:16px;float:left}
|
||||
.touch div.palette_item{height:30px;border-top:solid #2f2f2c 5px;border-bottom:solid #2f2f2c 5px;width:19px;float:left}
|
||||
.menu .menu_list{display:none;position:absolute}
|
||||
.tool_button:hover,.push_button:hover,.buttonup:hover,.buttondown,.tool_button_current,.push_button_pressed{background-color:#fff}
|
||||
.tool_button.disabled,.tool_button.disabled:hover{opacity:.3;background-color:#aaa}
|
||||
|
@ -403,7 +402,8 @@ button.cancel,input.Cancel,input.cancel,input.jGraduate_Cancel,button.cancel{-we
|
|||
body.dragging *{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
body.drag *{cursor:url(images/dragging.png),move;cursor:-webkit-grabbing;cursor:-moz-grabbing}
|
||||
input[readonly=readonly]:focus{box-shadow:none}
|
||||
#color_canvas_tools{background:#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;width:60px;height:40px;margin:23px 5px 5px 5px;position:relative;overflow:hidden}
|
||||
#color_canvas_tools,#fill_bg,#stroke_bg{background:#fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat}
|
||||
#color_canvas_tools{width:60px;height:40px;margin:23px 5px 5px 5px;position:relative;overflow:hidden}
|
||||
#color_canvas_tools{display:block}
|
||||
#tool_angle_indicator{width:50px;height:50px;border-radius:50px;background:rgba(255,255,255,0.05);position:absolute;bottom:2px;left:10px}
|
||||
#tool_angle_indicator_cursor{width:4px;height:25px;border-top:solid #50a0ff 3px;position:absolute;margin:0 0 0 23px;-webkit-transform-origin:50% 0;-moz-transform-origin:50% 0;-o-transform-origin:50% 0;-ms-transform-origin:50% 0;transform-origin:50% 0}
|
||||
|
|
|
@ -385,74 +385,75 @@ b.setCustomHandlers=function(c){b.ready(function(){if(c.open){a('#tool_open > in
|
|||
else if(o.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(o.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);var c=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(n){if(!n){n=document.createElement("script");n.src=curConfig.extPath+k;document.querySelector("head").appendChild(n)}})})};document.location.protocol==="file:"?setTimeout(c,100):c();
|
||||
a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",
|
||||
align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",arrow_right:"flyouth.png",arrow_down:"dropdown.gif"},placement:{"#logo":"logo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_node_clone":"node_clone","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath",
|
||||
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,
|
||||
"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+
|
||||
"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=
|
||||
setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var l=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",
|
||||
K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars",ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+
|
||||
'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,
|
||||
E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,
|
||||
w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()==
|
||||
"zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=
|
||||
a(ha.parent+"_show").hasClass("tool_button_current"),qa=a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",
|
||||
ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?
|
||||
200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left",fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=
|
||||
a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:
|
||||
{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};
|
||||
document.getElementById("canvas_background")||Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Fa=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();
|
||||
n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":
|
||||
"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=
|
||||
null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));
|
||||
a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={g:[],a:[],rect:["rx","width","height","x","y"],image:["width",
|
||||
"height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+
|
||||
"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,
|
||||
"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||
|
||||
H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",
|
||||
function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&na();if(o==="pathedit")return Fa();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();
|
||||
break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J=w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Fa();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=
|
||||
null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",
|
||||
function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Fa();if(X&&o==="select"){b.paintBox.fill.update();
|
||||
b.paintBox.stroke.update()}g.runExtensions("elementChanged",{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done",
|
||||
"all");E="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s",
|
||||
"PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});
|
||||
g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",
|
||||
Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';
|
||||
qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);
|
||||
W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba=
|
||||
"tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?
|
||||
Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");
|
||||
a("#"+W.list+"_opts").append(Qa);if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=
|
||||
[{sel:"#"+ua,fn:W.events.click,icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+
|
||||
W.key+"]")}}else Qa.bind(Cb,Jb);else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!l,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00",
|
||||
"#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,n){Ma+='<div class="palette_item" style="background-color: '+n+';" data-rgb="'+n+'"></div>'});a("#palette").append(Ma);var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";
|
||||
Ga.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});
|
||||
a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);
|
||||
k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),n=k?"stroke":"fill",o=a(this).attr("data-rgb"),w=null;if(o==="transparent"||o==="initial"||o==="#none"){o="none";w=new a.jGraduate.Paint}else w=new a.jGraduate.Paint({alpha:100,solidColor:o.substr(1)});b.paintBox[n].setPaint(w);
|
||||
if(k){g.setColor("stroke",o);o!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",o);o!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;
|
||||
if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type===
|
||||
"mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault();g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup",
|
||||
"alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});
|
||||
a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",
|
||||
function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");
|
||||
E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup");n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,
|
||||
arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=
|
||||
this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N=
|
||||
"canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Da=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},
|
||||
Ea=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+
|
||||
K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&
|
||||
window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Fa()}},ob=function(){X!=
|
||||
null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
|
||||
false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},ca=function(){g.cycleElement(0)},Ca=function(k,n){if(!(X==null||U)){k||(n*=-1);
|
||||
var o=a("#angle").val()*1+n;g.setRotationAngle(o);Fa()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Fa();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Fa()},Za=function(){g.setItalic(!g.getItalic());Fa()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?
|
||||
g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},
|
||||
Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
|
||||
if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=
|
||||
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
|
||||
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=ga=g.getSvgString();a("#svg_source_textarea").val(o);
|
||||
a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+n)},gb;gb=function(){var k=
|
||||
/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+O));w.data("orig_margin-"+
|
||||
O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();Nb(o,w);E.css("visibility",
|
||||
"visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
"#tool_openclose_path":"open_path","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#zoomLabel":"zoom"},resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?
|
||||
24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var k=a("#tools_left");if(k.length!=0){k.offset();k.outerHeight()}a(".tools_flyout").each(function(){var n=a("#"+this.id+"_show"),o=n.attr("data-curopt");if(!n.children("svg, img").length){o=
|
||||
a(o).children().clone();if(o.length){o[0].removeAttribute("style");n.append(o)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(k){a("#base_unit_container").css({top:k.pageY-10,left:k.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter",function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);
|
||||
event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=g=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};c=navigator.platform.indexOf("Mac")>=0;var l=navigator.userAgent.indexOf("AppleWebKit")>=0,u=c?"meta+":"ctrl+",C=g.pathActions,s=g.undoMgr,L=svgedit.utilities,R=curConfig.imgPath+"placeholder.svg",K=a("#workarea"),I=a("#cmenu_canvas"),Q=null,S=1,N="toolbars",
|
||||
ga="";c||a(".shortcut").each(function(){var k=a(this).text();a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var k=a("#dialog_box"),n=a("#dialog_buttons"),o=function(w,E,H,J){a("#dialog_content").html("<p>"+E.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt",w=="prompt");n.empty();var O=a('<input type="button" value="'+uiStrings.common.ok+'">').appendTo(n);w!="alert"&&a('<input type="button" value="'+
|
||||
uiStrings.common.cancel+'">').appendTo(n).on("click touchstart",function(){k.hide();H(false)});if(w=="prompt"){var Y=a('<input type="text">').prependTo(n);Y.val(J||"");Y.bind("keydown","return",function(){O.trigger("click touchstart")})}w=="process"&&O.hide();k.show();O.on("click touchstart",function(){k.hide();var da=w=="prompt"?Y.val():true;H&&H(da)}).focus();w=="prompt"&&Y.focus()};a.alert=function(w,E){o("alert",w,E)};a.confirm=function(w,E){o("confirm",w,E)};a.process_cancel=function(w,E){o("process",
|
||||
w,E)};a.prompt=function(w,E,H){o("prompt",w,H,E)}})();var na=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,U=false,ea=false,Aa="",ja=function(k,n){var o=g.getResolution(),w=K;a("#svgcanvas").position();if(w=g.setBBoxZoom(n,w.width()-15,w.height()-15)){var E=w.zoom;w=w.bbox;if(E<0.0010)wa({value:0.1});
|
||||
else{typeof animatedZoom!="undefined"&&k.cancelAnimationFrame(animatedZoom);var H=Date.now(),J=E-o.zoom;a("#zoom");var O=o.zoom,Y=function(da){da=(da-H)/500;da=Math.pow(da-1,3)+1;g.setZoom(O+J*da);G();if(da<1)k.animatedZoom=requestAnimationFrame(Y);else{a("#zoom").val(parseInt(E*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(E*100)+"]","#zoom_select").attr("selected","selected")}};Y(Date.now());g.getMode()=="zoom"&&w.width&&na();xb()}}};a("#cur_context_panel").delegate("a",
|
||||
"click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var ba=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},T={},Z=function(k){a.each(k,function(n,o){var w=a(n).children(),E=n+"_show",H=a(E),J=false;w.addClass("tool_button").unbind("click mousedown mouseup").each(function(da){var V=o[da];T[V.sel]=V.fn;if(V.isDefault)J=da;da=function(fa){var ha=V;if(fa.type==="keydown"){var W=a(ha.parent+"_show").hasClass("tool_button_current"),qa=
|
||||
a(ha.parent+"_show").attr("data-curopt");a.each(k[V.parent],function(za,Ba){if(Ba.sel==qa)ha=!fa.shiftKey||!W?Ba:k[V.parent][za+1]||k[V.parent][0]})}if(a(this).hasClass("disabled"))return false;ra(E)&&ha.fn();var ua=ha.icon?a.getSvgIcon(ha.icon,true):a(ha.sel).children().eq(0).clone();ua[0].setAttribute("width",H.width());ua[0].setAttribute("height",H.height());H.children(":not(.flyout_arrow_horiz)").remove();H.append(ua).attr("data-curopt",ha.sel)};a(this).mouseup(da);V.key&&a(document).bind("keydown",
|
||||
V.key[0]+" shift+"+V.key[0],da)});if(J)H.attr("data-curopt",o[J].sel);else H.attr("data-curopt")||H.attr("data-curopt",o[0].sel);var O,Y=a(E).position();a(n).css({left:Y.left+34,top:Y.top+77});H.mousedown(function(da){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&ra(E,false);if(H.hasClass("disabled"))return false;var V=a(n),fa=Y.left+34,ha=V.width()*-1,W=V.data("shown_popop")?200:0;O=setTimeout(function(){H.data("isLibrary")?V.css("left",
|
||||
fa).show():V.css("left",ha).show().animate({left:fa},50);V.data("shown_popop",true)},W);da.preventDefault()}).mouseup(function(){clearTimeout(O);var da=a(this).attr("data-curopt");if(H.data("isLibrary")&&a(E.replace("_show","")).is(":visible"))ra(E,true);else ra(E)&&da in T&&T[da]()})});ma()},oa=function(k,n){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(n)},pa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show"),n=k.offset();k=k.outerWidth();
|
||||
a(this).css({left:(n.left+k)*S,top:n.top})})},ma=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var n=[];a(this).children().each(function(){n.push(this.title)});k[0].title=n.join(" / ")}})},la,xa=function(k,n,o){var w=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+o+"_color defs *")[0];w={alpha:n};w[k.tagName]=k}else w=k.indexOf("#")===0?{alpha:n,solidColor:k.substr(1)}:{alpha:n,solidColor:"none"};return new a.jGraduate.Paint(w)},
|
||||
ya=g.getResolution();if(curConfig.baseUnit!=="px"){ya.w=svgedit.units.convertUnit(ya.w)+curConfig.baseUnit;ya.h=svgedit.units.convertUnit(ya.h)+curConfig.baseUnit}var Ja=function(k){g.createLayer("background");cur_shape=g.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:ya.w+2,height:ya.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:k||"#fff",style:"pointer-events:none"}});g.setCurrentLayer("Layer 1");g.setCurrentLayerPosition("1")};document.getElementById("canvas_background")||
|
||||
Ja();document.getElementById("canvas_background").getAttribute("fill");var Ha=b.setImageURL=function(k){k||(k=R);g.setImageURL(k);a("#image_url").val(k)},Fa=function(){var k=X;if(k!=null&&!k.parentNode)k=null;if(U&&U[0]!=null&&!U[0].parentNode)U=false;var n=g.getCurrentDrawing().getCurrentLayerName(),o=g.getMode(),w=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,E=o=="pathedit";if(E){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide();n=C.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");
|
||||
a("#tool_node_delete").toggleClass("disabled",!C.canDeleteNodes);zb("#tool_openclose_path",C.closed_subpath?"open_path":"close_path");if(n){E=a("#seg_type");if(w){n.x=svgedit.units.convertUnit(n.x);n.y=svgedit.units.convertUnit(n.y)}a("#path_node_x").val(Math.round(n.x));a("#path_node_y").val(Math.round(n.y));if(n.type){E.val(n.type).removeAttr("disabled");a("#seg_type_label").html(n.type==4?"Straight":"Curve")}else E.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected");
|
||||
a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var H=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(U){U=U.filter(Boolean);(k=g.elementsAreSame(U)?U[0]:null)&&a("#tools_top").addClass("multiselected")}if(!k&&!U){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(k!=null){a("#stroke_panel").show();var J=k.nodeName,O=g.getRotationAngle(k);
|
||||
a("#angle").val(Math.round(O));O=g.getBlur(k);a("#blur").val(O);if(!E&&o!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var Y,da;if(["g","polyline","path"].indexOf(J)>=0)if(o=g.getStrokedBBox([k])){Y=o.x;da=o.y}if(w){Y=svgedit.units.convertUnit(Y);da=svgedit.units.convertUnit(da)}a("#"+J+"_x").val(Math.round(Y));a("#"+J+"_y").val(Math.round(da));if(J==="polyline"){a("#path_x").val(Math.round(Y));a("#path_y").val(Math.round(da))}["image","text","path","g","use"].indexOf(J)==
|
||||
-1&&a(".action_path_convert_selected").removeClass("disabled");J==="path"&&a(".action_path_selected").removeClass("disabled")}w=null;if(V==="a"){w=g.getHref(k);a("#g_panel").show()}if(k.parentNode.tagName==="a")if(!a(k).siblings().length){a("#a_panel").show();w=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!w);w&&a("#link_url").val(w);w={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1",
|
||||
"y1","x2","y2"],text:["x","y"],use:[],path:[]};var V=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();if(V=="path"||V=="polyline")a("#path_panel").show();if(w[V]){w=w[V];a("#"+V+"_panel").show();V=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(w,function(fa,ha){var W=k.getAttribute(ha);if(curConfig.baseUnit!=="px"&&k[ha])W=svgedit.units.convertUnit(k[ha].baseVal.value);var qa=document.getElementById(V+"_"+ha);qa.value=Math.round(W)||0;qa.getAttribute("data-cursor")===
|
||||
"true"&&a.fn.dragInput.updateCursor(qa)});if(V=="text"){w=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",g.getBold());a("#font_family").val(w);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(w.split(",")[0].replace(/'/g,"")).css("font-family",w);g.addedNew&&setTimeout(function(){a("#text").focus().select()},
|
||||
100)}else if(V=="image")Ha(g.getHref(k));else if(V==="g"||V==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}H[(V==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");H[(V==="g"||!U?"dis":"en")+"ableContextMenuItems"]("#group")}if(U){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");H.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||H.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");
|
||||
s.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");s.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");g.addedNew=false;if(k&&!E||U){a("#selLayerNames").removeAttr("disabled").val(n);I.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,n){var o=g.getMode();o==="select"&&
|
||||
na();if(o==="pathedit")return Fa();X=n.length==1||n[1]==null?n[0]:null;n=n.filter(Boolean);U=n.length>=2?n:false;if(g.elementsAreSame(U))X=U[0];if(X!=null){a("#multiselected_panel").hide();if(X!=null)switch(X.tagName){case "use":a(".context_panel").hide();a("#use_panel").show();break;case "image":a(".context_panel").hide();a("#image_panel").show();break;case "foreignObject":a(".context_panel").hide();break;case "g":case "a":o=null;for(var w=X.getElementsByTagName("*"),E=0,H=w.length;E<H;E++){var J=
|
||||
w[E].getAttribute("stroke-width");if(E===0)o=J;else if(o!==J)o=null}a("#stroke_width").val(o===null?"0":o);Fa();break;default:a("#stroke_width").val(X.getAttribute("stroke-width")||0);o=X.getAttribute("stroke-dasharray")||"none";a("option","#stroke_style").removeAttr("selected");a('#stroke_style option[value="'+o+'"]').attr("selected","selected");a("#stroke_style").trigger("change");a.fn.dragInput.updateCursor(a("#stroke_width")[0])}if(X!=null){o=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(o);
|
||||
a.fn.dragInput.updateCursor(a("#group_opacity")[0])}U.length&&a("#tools_top").addClass("multiselected")}else if(U.length){a(".context_panel").hide();a("#tools_top").removeClass("multiselected");a("#multiselected_panel").show()}else{a(".context_panel").hide();a("#canvas_panel").show();a("#tools_top").removeClass("multiselected")}g.runExtensions("selectedChanged",{elems:n,selectedElement:X,multiselected:U})});g.bind("transition",function(k,n){var o=g.getMode(),w=n[0];if(w){U=n.length>=2&&n[1]!=null?
|
||||
n:null;if(!U)switch(o){case "rotate":o=g.getRotationAngle(w);a("#angle").val(Math.round(o));rotateCursor(o);a("#tool_reorient").toggleClass("disabled",o==0)}g.runExtensions("elementTransition",{elems:n})}});g.bind("changed",function(k,n){var o=g.getMode();o==="select"&&na();for(var w=0;w<n.length;++w){var E=n[w];if(E&&E.tagName==="svg")G();else if(E&&X&&X.parentNode==null)X=E}b.show_save_warning=true;Fa();if(X&&o==="select"){b.paintBox.fill.update();b.paintBox.stroke.update()}g.runExtensions("elementChanged",
|
||||
{elems:n})});g.bind("saved",function(k,n){b.show_save_warning=false;n='<?xml version="1.0"?>\n'+n;var o=navigator.userAgent;if(~o.indexOf("MSIE"))Eb(0,true);else{var w=k.open("data:image/svg+xml;base64,"+L.encode64(n)),E=a.pref("save_notice_done");if(E!=="all"){var H=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(o.indexOf("Gecko/")!==-1)if(n.indexOf("<defs")!==-1){H+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");E="all"}else a.pref("save_notice_done",
|
||||
"part");else a.pref("save_notice_done","all");E!=="part"&&w.alert(H)}}});g.bind("exported",function(k,n){var o=n.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var w=a("#export_canvas")[0];w.width=g.contentW;w.height=g.contentH;canvg(w,n.svg,{renderCallback:function(){var E=w.toDataURL("image/png");Q.location.href=E;if(a.pref("export_notice_done")!=="all"){E=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(o.length)E+="\n\n"+uiStrings.notification.noteTheseIssues+
|
||||
"\n \u2022 "+o.join("\n \u2022 ");a.pref("export_notice_done","all");Q.alert(E)}}})});g.bind("zoomed",ja);g.bind("contextset",function(k,n){var o="";if(n){var w="";o='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(n).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){w+=" > "+this.id;o+=this!==n?' > <a href="#">'+this.id+"</a>":" > "+this.id}});Aa=w}else Aa=null;a("#cur_context_panel").toggle(!!n).html(o)});g.bind("extension_added",function(k,n){function o(){if(la){clearTimeout(la);
|
||||
la=null}E||(la=setTimeout(function(){E=true;Mb(v.iconsize)},50))}var w=false,E=false,H=true,J=function(){if(n.callback&&!w&&H){w=true;n.callback()}},O=[];n.context_tools&&a.each(n.context_tools,function(ha,W){var qa=W.container_id?' id="'+W.container_id+'"':"",ua=a("#"+W.panel);ua.length||(ua=a("<div>",{id:W.panel}).appendTo("#tools_top").hide());switch(W.type){case "tool_button":var za='<div class="tool_button">'+W.id+"</div>",Ba=a(za).appendTo(ua);W.events&&a.each(W.events,function(Na,jb){a(Ba).bind(Na,
|
||||
jb)});break;case "select":za="<label"+qa+'><select id="'+W.id+'">';a.each(W.options,function(Na,jb){za+='<option value="'+Na+'"'+(Na==W.defval?" selected":"")+">"+jb+"</option>"});za+="</select></label>";var Pa=a(za).appendTo(ua).find("select");a.each(W.events,function(Na,jb){a(Pa).bind(Na,jb)});break;case "button-select":za='<div id="'+W.id+'" class="dropdown toolset" title="'+W.title+'"><div id="cur_'+W.id+'" class="icon_label"></div><button></button></div>';qa=a('<ul id="'+W.id+'_opts"></ul>').appendTo("#option_lists");
|
||||
W.colnum&&qa.addClass("optcols"+W.colnum);a(za).appendTo(ua).children();O.push({elem:"#"+W.id,list:"#"+W.id+"_opts",title:W.title,callback:W.events.change,cur:"#cur_"+W.id});break;case "input":za="<label"+qa+'><span id="'+W.id+'_label">'+W.label+':</span><input id="'+W.id+'" title="'+W.title+'" size="'+(W.size||"4")+'" value="'+(W.defval||"")+'" type="text"/></label>';var Qa=a(za).appendTo(ua).find("input");W.spindata&&Qa.SpinButton(W.spindata);W.events&&a.each(W.events,function(Na,jb){Qa.bind(Na,
|
||||
jb)})}});if(n.buttons){var Y={},da={},V=n.svgicons,fa={};a.each(n.buttons,function(ha,W){for(var qa,ua=W.id,za=ha;a("#"+ua).length;)ua=W.id+"_"+ ++za;if(V){Y[ua]=W.icon;za=W.svgicon?W.svgicon:W.id;if(W.type=="app_menu")da["#"+ua+" > div"]=za;else da["#"+ua]=za}else qa=W.type=="menu"?"":a('<img src="'+W.icon+'">');var Ba,Pa;switch(W.type){case "mode_flyout":case "mode":Ba="tool_button";if(W.cls)Ba+=" "+W.cls;Pa="#tools_left";break;case "context":Ba="tool_button";Pa="#"+W.panel;a(Pa).length||a("<div>",
|
||||
{id:W.panel}).appendTo("#tools_top");break;case "menu":Ba="menu_item tool_button";Pa="#"+(W.after||W.panel);break;case "app_menu":Ba="";Pa=W.parent||"#main_menu ul";a(Pa).length||a("<div>",{id:W.panel}).appendTo("#tools_top")}var Qa=a(W.list||W.type=="app_menu"?"<li/>":"<div/>").attr("id",ua).attr("title",W.title).addClass(Ba);if(!W.includeWith&&!W.list){if("position"in W)a(Pa).children().eq(W.position).before(Qa);else W.type!="menu"||!W.after?Qa.appendTo(Pa):a(Pa).after(Qa);if(W.type=="mode_flyout"){za=
|
||||
a(Qa);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){var Na=za[0].id.replace("tool_","tools_"),jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za);Ba.data("isLibrary",true);jb.data("isLibrary",true)}da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,icon:W.id,isDefault:true},ub]}else if(W.type=="app_menu"||W.type=="menu")Qa.append(W.title)}else if(W.list){Qa.addClass("push_button");a("#"+W.list+"_opts").append(Qa);
|
||||
if(W.isDefault){a("#cur_"+W.list).append(Qa.children().clone());za=W.svgicon?W.svgicon:W.id;da["#cur_"+W.list]=za}}else if(W.includeWith){Pa=W.includeWith;za=a(Pa.button);Ba=za.parent();if(!za.parent().hasClass("tools_flyout")){Na=za[0].id.replace("tool_","tools_");jb=za.clone().attr("id",Na+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));za.before(jb);Ba=oa(Na,za)}var ub=B.getButtonData(Pa.button);if(Pa.isDefault)da["#"+Na+"_show"]=W.id;ua=fa["#"+Ba[0].id]=[{sel:"#"+ua,fn:W.events.click,
|
||||
icon:W.id,key:W.key,isDefault:W.includeWith?W.includeWith.isDefault:0},ub];Na="position"in Pa?Pa.position:"last";ub=Ba.children().length;if(!isNaN(Na)&&Na>=0&&Na<ub)Ba.children().eq(Na).before(Qa);else{Ba.append(Qa);ua.reverse()}}V||Qa.append(qa);W.list||a.each(W.events,function(Cb,Jb){if(Cb=="click")if(W.type=="mode"){W.includeWith?Qa.bind(Cb,Jb):Qa.bind(Cb,function(){ra(Qa)&&Jb()});if(W.key){a(document).bind("keydown",W.key,Jb);W.title&&Qa.attr("title",W.title+" ["+W.key+"]")}}else Qa.bind(Cb,Jb);
|
||||
else Qa.bind(Cb,Jb)});Z(fa)});a.each(O,function(){vb(this.elem,this.list,this.callback,{seticon:true})});if(V)H=false;a.svgIcons(V,{w:27,h:27,id_match:false,no_img:!l,fallback:Y,placement:da,callback:function(){v.iconsize&&v.iconsize!="m"&&o();H=true;J()}})}J()});g.textActions.setInputElem(a("#text")[0]);var Ma='<div class="palette_item transparent" data-rgb="none"></div>\t\t\t\t\t\t\t\t<div class="palette_item black" data-rgb="#000000"></div>\t\t\t\t\t\t\t\t<div class="palette_item white" data-rgb="#ffffff"></div>';
|
||||
["#482816","#422C10","#3B2F0E","#32320F","#293414","#1F361B","#153723","#0C372C","#083734","#0E353B","#1A333F","#273141","#332D40","#3E2A3C","#462735","#4B252D","#4D2425","#4C261D","#845335","#7B572D","#6F5C2A","#62612C","#546433","#46673D","#396849","#306856","#2D6862","#33666C","#426373","#535F75","#645A73","#74556D","#805064","#884D58","#8B4D4B","#894F3F","#C48157","#B8874D","#A98E49","#97944B","#849854","#729C62","#619E73","#559E84","#529D94","#5B9BA2","#6D97AB","#8391AE","#9A8AAB","#AF84A3",
|
||||
"#BF7E96","#C97A86","#CE7975","#CC7C65","#FFB27C","#FABA6F","#E6C36A","#CFCA6D","#B8D078","#A0D58A","#8CD79F","#7DD8B5","#7AD6CA","#84D3DB","#9ACEE6","#B6C7EA","#D3BEE7","#EDB6DC","#FFAFCC","#FFAAB8","#FFA9A2","#FFAC8D","#FFE7A2","#FFF093","#FFFA8D","#FFFF91","#EEFF9F","#D1FFB4","#B9FFCE","#A8FFE9","#A4FFFF","#B1FFFF","#CBFFFF","#EDFFFF","#FFF5FF","#FFEBFF","#FFE2FF","#FFDCEC","#FFDBD2","#FFDFB8"].forEach(function(k){Ma+='<div class="palette_item" style="background-color: '+k+';" data-rgb="'+k+'"></div>'});
|
||||
a("#palette").append(Ma);var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ga.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var n=k.value/100;if(n<0.0010)k.value=0.1;else{k=g.getZoom();var o=K;ja(window,{width:0,height:0,x:(o[0].scrollLeft+o.width()/2)/k,y:(o[0].scrollTop+o.height()/2)/k,zoom:n},true)}};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());
|
||||
a("#stroke_style_label").html(this.options[this.selectedIndex].text);window.opera&&a("<p/>").hide().appendTo("body").remove()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k){var n=k.getAttribute("data-attr"),o=k.getAttribute("data-multiplier")||
|
||||
1;o=parseFloat(o);o=k.value*o;if(!svgedit.units.isValidUnit(n,o,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(n);return false}g.changeSelectedAttributeNoUndo(n,o)};picking=false;a(document).on("mouseup",function(){picking=false});a("#palette").on("mousemove mousedown touchstart touchmove",".palette_item",function(k){k.preventDefault();if(k.type=="mousedown")picking=true;if(picking){var n=a("#tool_stroke").hasClass("active"),o=n?"stroke":"fill",w=a(this).attr("data-rgb"),
|
||||
E=null,H=true;if(k.type=="mousedown")H=false;if(w==="transparent"||w==="initial"||w==="#none"){w="none";E=new a.jGraduate.Paint}else E=new a.jGraduate.Paint({alpha:100,solidColor:w.substr(1)});b.paintBox[o].setPaint(E);if(n){g.setColor("stroke",w,H);w!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",w,H);w!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display",
|
||||
"table-cell");a(this).addClass("expanded");Db()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");Db()});var ra=function(k,n){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;var o=o||"normal";n||a(".tools_flyout").fadeOut(o);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=
|
||||
null,n=null,o=K[0],w=false,E=false;a("#svgcanvas").on("mousemove mouseup touchend",function(H){if(w!==false){o.scrollLeft-=H.clientX-k;o.scrollTop-=H.clientY-n;k=H.clientX;n=H.clientY;if(H.type==="mouseup"||H.type==="touchend")w=false;return false}}).on("mousedown touchmove",function(H){if(H.button===1||E===true||H.originalEvent.touches&&H.originalEvent.touches.length>=2){w=true;k=H.clientX;n=H.clientY;return false}});a(window).mouseup(function(){w=false});a(document).bind("keydown","space",function(H){H.preventDefault();
|
||||
g.spaceKey=E=true}).bind("keyup","space",function(H){H.preventDefault();g.spaceKey=E=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&K.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&K.removeClass("out")})})();var va=a(".menu"),kb=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=
|
||||
""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){kb(k)});a("svg, body").on("mousedown touchstart",function(k){if(!(k.target.nodeName&&k.target.nodeName.toLowerCase()==="input"))if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?kb(k):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",
|
||||
function(k,n,o,w){if(k.altKey){k.preventDefault();zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+w*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");va.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){va.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(k,n,o){if(a(k).length!=0){var w=a(k).find("button"),E=a(k).find("ul").attr("id",a(k)[0].id+"-list");
|
||||
o||a("#option_lists").append(E);var H=false;o&&a(k).addClass("dropup");E.find("li").bind("mouseup",n);a(window).mouseup(function(){if(!H){w.removeClass("down");E.hide()}H=false});w.bind("mousedown",function(){if(w.hasClass("down")){w.removeClass("down");E.hide()}else{w.addClass("down");if(!o){var J=a(k).offset();E.css({top:J.top,left:J.left-110})}E.show();H=true}}).hover(function(){H=true}).mouseout(function(){H=false})}};var vb=function(k,n,o,w){var E=a(k);n=a(n);var H=false,J=w.dropUp;J&&a(k).addClass("dropup");
|
||||
n.find("li").bind("mouseup",function(){if(w.seticon){zb("#cur_"+E[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}o.apply(this,arguments)});a(window).mouseup(function(){if(!H){E.removeClass("down");n.hide();n.css({top:0,left:0})}H=false});n.height();a(k).bind("mousedown",function(){var O=a(k).offset();if(J){O.top-=n.height();O.left+=8}else O.top+=a(k).height();a(n).offset(O);if(E.hasClass("down")){E.removeClass("down");n.hide();n.css({top:0,left:0})}else{E.addClass("down");
|
||||
n.show();H=true;return false}}).hover(function(){H=true}).mouseout(function(){H=false});w.multiclick&&n.mousedown(function(){H=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,n=this.options[this.selectedIndex].text;a("#preview_font").html(n).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,
|
||||
"page")})});(function(){var k,n=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;N="toolbars";K.mousedown(n)}).blur(function(){N="canvas";K.unbind("mousedown",n);g.getMode()=="textedit"&&a("#text").focus()})})();var cb=function(){ra("#tool_select")&&g.setMode("select")},Ta=function(){ra("#tool_fhpath")&&g.setMode("fhpath")},Va=function(){ra("#tool_line")&&g.setMode("line")},Da=function(){ra("#tool_rect")&&g.setMode("rect")},ta=function(){ra("#tool_ellipse")&&
|
||||
g.setMode("ellipse")},$a=function(){ra("#tool_image")&&g.setMode("image")},Ka=function(){ra("#tool_zoom")&&g.setMode("zoom")},Sa=function(){if(ra("#tool_zoom")){yb();na()}},Ea=function(){ra("#tool_text")&&g.setMode("text")},db=function(){ra("#tool_path")&&g.setMode("path")},lb=function(){if(X!=null||U)g.deleteSelectedElements()},Ua=function(){if(X!=null||U){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cutSelectedElements()}},Xa=function(){if(X!=null||U){window.event&&window.event.type===
|
||||
"keydown"&&Ia(a("#edit_menu"));g.copySelectedElements()}},wb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));var k=g.getZoom(),n=(K[0].scrollLeft+K.width()/2)/k-g.contentW;k=(K[0].scrollTop+K.height()/2)/k-g.contentH;g.pasteElements("point",n,k)},sa=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToTopSelectedElement()}},hb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveToBottomSelectedElement()}},
|
||||
eb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Up")}},sb=function(){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected("Down")}},ib=function(k){if(X!=null){window.event&&window.event.type==="keydown"&&Ia(a("#object_menu"));g.moveUpDownSelected(k)}},ab=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).reset(elems[0]);g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
|
||||
"none");g.setMode("pathedit");C.toEditMode(elems[0]);g.clearSelection();Fa()}},ob=function(){X!=null&&C.reorient()},pb=function(){if(X!=null||U)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},fb=function(k,n){if(X!=null||U){if(curConfig.gridSnapping){var o=g.getZoom()*curConfig.snappingStep;k*=o;n*=o}a("input").blur();g.moveSelectedElements(k,n)}},tb=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
|
||||
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);C.linkControlPoints(k)},ia=function(){C.getNodePoint()&&C.clonePathNode()},aa=function(){C.getNodePoint()&&C.deletePathNode()},ka=function(){var k=a("#tool_add_subpath"),n=!k.hasClass("push_button_pressed");n?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");C.addSubPath(n)},M=function(){C.opencloseSubPath()},P=function(){g.cycleElement(1)},
|
||||
ca=function(){g.cycleElement(0)},Ca=function(k,n){if(!(X==null||U)){k||(n*=-1);var o=a("#angle").val()*1+n;g.setRotationAngle(o);Fa()}},Oa=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(n){if(n){na();g.clear();g.setResolution(k[0],k[1]);G(true);yb();Fa();ba();g.runExtensions("onNewDocument")}})},Wa=function(){g.setBold(!g.getBold());Fa()},Za=function(){g.setItalic(!g.getItalic());Fa()},nb=function(){if(!d.pngsave){var k=uiStrings.notification.loadingImage;
|
||||
Q=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},Ra=function(){g.open()},mb=function(){},Ia=function(k){var n=k.prev();n.css("background","#09f");setTimeout(function(){n.css("background","")},200)},qb=function(){if(s.getUndoStackSize()>0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.undo()}},rb=function(){if(s.getRedoStackSize()>
|
||||
0){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));s.redo()}},Bb=function(){if(U)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Fb=function(){window.event&&window.event.type==="keydown"&&Ia(a("#edit_menu"));g.cloneSelectedElements(20,20)},bb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},La=function(){var k=document.querySelector("#tool_stroke rect"),n=document.querySelector("#tool_fill rect"),o=
|
||||
n.getAttribute("fill"),w=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;n=parseFloat(n.getAttribute("fill-opacity"));if(isNaN(n))n=100;w=xa(w,k,"stroke");o=xa(o,n,"fill");b.paintBox.fill.setPaint(w,true);b.paintBox.stroke.setPaint(o,true)},yb=function(k){var n=g.getResolution();k=k?n.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);xb();G(true)},Hb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):
|
||||
a("#tool_wireframe").removeClass("push_button_pressed");K.toggleClass("wireframe");if(!h){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");xb()}},Gb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Ib=function(){window.self!=window.top&&top.exit_fullscreen()},Lb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
|
||||
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},xb=function(){if(!h){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(K.hasClass("wireframe")?k:"")}},Eb=function(k,n){if(!ea){ea=true;a("#save_output_btns").toggle(!!n);a("#tool_source_back").toggle(!n);var o=
|
||||
ga=g.getSvgString();a("#svg_source_textarea").val(o);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}},Kb=function(){if(ea){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();Ya();yb();ba()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();Ya();yb();ba()});na()}},zb=b.setIcon=function(k,n){var o=typeof n==="string"?a.getSvgIcon(n,true):n.clone();o?a(k).find("img").replaceWith(o):console.log("NOTE: Icon image missing: "+
|
||||
n)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,n=document.getElementsByTagName("script")[0],o;for(o in n.style)if(k.test(o))return o.match(k)[0];if("WebkitOpacity"in n.style)return"Webkit";if("KhtmlOpacity"in n.style)return"Khtml";return""}();var Nb=function(k,n){gb.toLowerCase();var o=["top","left","bottom","right"];k.each(function(){for(var w=a(this),E=w.outerWidth()*(n-1),H=w.outerHeight()*(n-1),J=0;J<4;J++){var O=o[J],Y=w.data("orig_margin-"+O);if(Y==null){Y=parseInt(w.css("margin-"+
|
||||
O));w.data("orig_margin-"+O,Y)}Y=Y*n;if(O==="right")Y+=E;else if(O==="bottom")Y+=H;w.css("margin-"+O,Y)}})},Mb=b.setIconSize=function(k,n){if(!(k==v.size&&!n)){var o=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),w=1;w=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];b.tool_scale=S=w;pa();var E=o.parents(":hidden");E.css("visibility","hidden").show();
|
||||
Nb(o,w);E.css("visibility","visible").hide();o=a("#tool_size_rules");if(o.length)o.empty();else o=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var H="";a.each(cssResizeRules,function(J,O){J="#svg_editor "+J.replace(/,/g,", #svg_editor");H+=J+"{";a.each(O,function(Y,da){if(typeof da==="number")var V=da*w+"px";else if(da[k]||da.all)V=da[k]||da.all;H+=Y+":"+V+";"});H+="}"});E="-"+gb.toLowerCase()+"-";H+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
|
||||
E+"transform: scale("+w+");} #svg_editor div.toolset .toolset {"+E+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+E+"transform: scale("+1/w+");}";o.text(H)}pa()}},Ab=function(){a("#dialog_box").hide();if(ea){if(ea)ga!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&Ya()}):Ya();Db()}else Aa&&g.leaveContext()},Ya=function(){a("#svg_source_editor").hide();ea=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
|
||||
var Db=a.noop;a(window).resize(function(){G()});(function(){K.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=K[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=K[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(n){n&&Ha(n)})});var e=function(k){var n=k[0].id=="stroke_color"?"stroke":
|
||||
"fill",o=k[0].id=="canvas_color";if(o)n="canvas";var w=b.paintBox[n].paint;k=n=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";o=o?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(o).jGraduate({paint:w,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(E){w=new a.jGraduate.Paint(E);b.paintBox[n].setPaint(w);
|
||||
|
|
|
@ -604,7 +604,6 @@ html, body {
|
|||
height: 100%;
|
||||
}
|
||||
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
|
@ -857,29 +856,46 @@ html, body {
|
|||
overflow: hidden;
|
||||
}
|
||||
|
||||
div#palette_holder {
|
||||
#palette {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
height: 31px;
|
||||
margin-top: 10px;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 10px;
|
||||
bottom: 5px;
|
||||
width: 400px;
|
||||
right: 145px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.palette_item {
|
||||
height: 20%;
|
||||
width: 5.4%;
|
||||
float: left;
|
||||
cursor: url(images/eyedropper.png) 0 16, crosshair;
|
||||
}
|
||||
|
||||
.touch div#palette_holder {
|
||||
height: 40px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item:first-child {
|
||||
.palette_item.transparent, .palette_item.white, .palette_item.black {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: -10px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
div#palette_holder #palette .palette_item {
|
||||
cursor: pointer;
|
||||
.palette_item.transparent {
|
||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAVdEVYdENyZWF0aW9uIFRpbWUAOC8yMi8xMg1cp6sAAABESURBVBiVjdBBCgAgCETRr/e/87SJKFPLnfIcQRMIwMBIShIAvgZzoSrfkzrs8WyF1+kX9r3p8AE7nL7kSpSshN+JEQ8GixkF0mSevgAAAABJRU5ErkJggg==);
|
||||
}
|
||||
|
||||
.palette_item.black {
|
||||
background: #000;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.palette_item.white {
|
||||
background: #fff;
|
||||
top: 20px;
|
||||
}
|
||||
|
||||
#color_tools {
|
||||
position: relative;
|
||||
|
@ -1008,7 +1024,6 @@ html, body {
|
|||
left: 1px;
|
||||
bottom: 1px;
|
||||
right: 1px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.touch #color_tools #tool_fill .color_block #fill_bg, .touch #color_tools #tool_stroke .color_block #stroke_bg {
|
||||
|
@ -1102,11 +1117,6 @@ html, body {
|
|||
padding-top: 4px;
|
||||
}
|
||||
|
||||
div#palette {
|
||||
float: left;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
div#workarea {
|
||||
display: inline-table-cell;
|
||||
position:absolute;
|
||||
|
@ -1128,20 +1138,6 @@ html, body {
|
|||
top: 40px;
|
||||
}
|
||||
|
||||
div.palette_item {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.touch div.palette_item {
|
||||
height: 30px;
|
||||
border-top: solid #2f2f2c 5px;
|
||||
border-bottom: solid #2f2f2c 5px;
|
||||
width: 19px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.menu .menu_list {
|
||||
display: none;
|
||||
position: absolute;
|
||||
|
@ -2600,8 +2596,11 @@ input[readonly=readonly]:focus {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
#color_canvas_tools, #fill_bg, #stroke_bg {
|
||||
background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMAQMAAABsu86kAAAAA3NCSVQICAjb4U/gAAAABlBMVEXu7u7///8o06qaAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADcvMjIvMTL7FNdCAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M1cbXjNgAAABFJREFUCJljYP7AgIb+MKAhAM8/C5vWL6zSAAAAAElFTkSuQmCC) top left repeat;
|
||||
}
|
||||
|
||||
#color_canvas_tools {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
margin: 23px 5px 5px 5px;
|
||||
|
|
Loading…
Reference in New Issue