From c9baffc9c1ddbc5f54007b3664074ae4efb965b7 Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Thu, 19 Jul 2012 09:54:50 -0500 Subject: [PATCH] improvements to the eyedropper --- editor/.DS_Store | Bin 21508 -> 21508 bytes editor/extensions/ext-eyedropper.js | 49 +- editor/extensions/ext-grid.js | 2 +- editor/extensions/ext-shapes.js | 1 - editor/hover.js | 147 ++++ editor/svg-editor.css | 5 + editor/svg-editor.html | 30 +- editor/svg-editor.js | 91 ++- editor/svgcanvas.js | 19 +- editor/svgedit.compiled.css | 1 + editor/svgedit.compiled.js | 992 ++++++++++++----------- editor/temp.css | 6 +- method-draw/extensions/ext-eyedropper.js | 49 +- method-draw/extensions/ext-grid.js | 2 +- method-draw/extensions/ext-shapes.js | 1 - method-draw/hover.js | 147 ++++ method-draw/svg-editor.css | 5 + method-draw/svg-editor.html | 30 +- method-draw/svg-editor.js | 91 ++- method-draw/svgcanvas.js | 19 +- method-draw/svgedit.compiled.css | 1 + method-draw/svgedit.compiled.js | 992 ++++++++++++----------- method-draw/temp.css | 6 +- 23 files changed, 1534 insertions(+), 1152 deletions(-) create mode 100644 editor/hover.js create mode 100644 method-draw/hover.js diff --git a/editor/.DS_Store b/editor/.DS_Store index f806abd7435dfc4d2c2a0dc5a994366d0f3fb57c..40f1193d26513e2be820d61ae791c0f35cf0480c 100644 GIT binary patch delta 202 zcmZo!!Pv5bae@>RL)%0dV^K2(1_ovZ1_1_!M22*RREA>Doc!d8h02o+bXX>HGm1{$ zrY_5##8AYL&rrTu(7>5}Gdl+h2czO-0md_%`2>vlH*+h@W9R2!$N;J+0~%1opvRCk zIZ#G!GLN{P4A68|AO->rZXn?bw222uw=pm%aBmi5de1zWUq_dd5h!#3h#4l^@JLUN W(V4sXugV%GT!sRj@mYCd11|svUMnR4 delta 156 zcmZo!!Pv5bae@>RBgaG;V^LEE1_ovZ1_1_!M22*RREFZD^5TMt7Z*=9&|#U_Ejn37 zV9(?`3K|n?z?6UDgHxNi73Q%|oUAo@u7rssE6^Aq(BK9Vu0Z2> x7#J8i7#I||H(q?tJegld7bpM}0^$ZBp6sKuaq~}=4NOq&n?(#hC{KLA3jl3pDOCUf diff --git a/editor/extensions/ext-eyedropper.js b/editor/extensions/ext-eyedropper.js index 435dac1..2108b7b 100644 --- a/editor/extensions/ext-eyedropper.js +++ b/editor/extensions/ext-eyedropper.js @@ -34,9 +34,8 @@ svgEditor.addExtension("eyedropper", function(S) { var elem = null; var tool = $('#tool_eyedropper'); - // enable-eye-dropper if one element is selected - if (!opts.multiselected && opts.elems[0] && + if (opts.elems[0] && $.inArray(opts.elems[0].nodeName, ['svg', 'g', 'use']) == -1) { elem = opts.elems[0]; @@ -52,6 +51,7 @@ svgEditor.addExtension("eyedropper", function(S) { var getPaint = function(color, opac, type) { // update the editor's fill paint var opts = null; + console.log(color); if (color.indexOf("url(#") === 0) { var refElem = svgCanvas.getRefElem(color); if(refElem) { @@ -100,43 +100,44 @@ svgEditor.addExtension("eyedropper", function(S) { elementChanged: getStyle, mouseDown: function(opts) { var mode = svgCanvas.getMode(); - if (mode == "eyedropper") { - var e = opts.event; - var target = e.target; + var e = opts.event; + var target = (e.target.id === "svgroot") ? document.getElementById('canvas_background') : e.target; + if (mode == "eyedropper" && target) { currentStyle.fillPaint = target.getAttribute("fill") || "white"; currentStyle.fillOpacity = target.getAttribute("fill-opacity") || 1.0; - currentStyle.strokePaint = target.getAttribute("stroke"); + currentStyle.strokePaint = target.getAttribute("stroke") || 'none'; currentStyle.strokeOpacity = target.getAttribute("stroke-opacity") || 1.0; currentStyle.strokeWidth = target.getAttribute("stroke-width"); currentStyle.strokeDashArray = target.getAttribute("stroke-dasharray"); currentStyle.strokeLinecap = target.getAttribute("stroke-linecap"); currentStyle.strokeLinejoin = target.getAttribute("stroke-linejoin"); currentStyle.opacity = target.getAttribute("opacity") || 1.0; - if ($.inArray(target.nodeName, ['g', 'use']) == -1) { + if ($.inArray(opts.selectedElements.nodeName, ['g', 'use']) == -1) { var changes = {}; - var change = function(elem, attrname, newvalue) { changes[attrname] = elem.getAttribute(attrname); elem.setAttribute(attrname, newvalue); }; - - if (currentStyle.fillPaint) change(opts.selectedElements[0], "fill", currentStyle.fillPaint); - if (currentStyle.fillOpacity) change(opts.selectedElements[0], "fill-opacity", currentStyle.fillOpacity); - if (currentStyle.strokePaint) change(opts.selectedElements[0], "stroke", currentStyle.strokePaint); - if (currentStyle.strokeOpacity) change(opts.selectedElements[0], "stroke-opacity", currentStyle.strokeOpacity); - if (currentStyle.strokeWidth) change(opts.selectedElements[0], "stroke-width", currentStyle.strokeWidth); - if (currentStyle.strokeDashArray) change(opts.selectedElements[0], "stroke-dasharray", currentStyle.strokeDashArray); - if (currentStyle.opacity) change(opts.selectedElements[0], "opacity", currentStyle.opacity); - if (currentStyle.strokeLinecap) change(opts.selectedElements[0], "stroke-linecap", currentStyle.strokeLinecap); - if (currentStyle.strokeLinejoin) change(opts.selectedElements[0], "stroke-linejoin", currentStyle.strokeLinejoin); - + var batchCmd = new S.BatchCommand(); + opts.selectedElements.forEach(function(element){ + if (currentStyle.fillPaint) change(element, "fill", currentStyle.fillPaint); + if (currentStyle.fillOpacity) change(element, "fill-opacity", currentStyle.fillOpacity); + if (currentStyle.strokePaint) change(element, "stroke", currentStyle.strokePaint); + if (currentStyle.strokeOpacity) change(element, "stroke-opacity", currentStyle.strokeOpacity); + if (currentStyle.strokeWidth) change(element, "stroke-width", currentStyle.strokeWidth); + if (currentStyle.strokeDashArray) change(element, "stroke-dasharray", currentStyle.strokeDashArray); + if (currentStyle.opacity) change(element, "opacity", currentStyle.opacity); + if (currentStyle.strokeLinecap) change(element, "stroke-linecap", currentStyle.strokeLinecap); + if (currentStyle.strokeLinejoin) change(element, "stroke-linejoin", currentStyle.strokeLinejoin); + batchCmd.addSubCommand(new ChangeElementCommand(element, changes)); + console.log(changes); + changes = {}; + }); var fill = getPaint(currentStyle.fillPaint, currentStyle.fillOpacity*100, "fill") var stroke = getPaint(currentStyle.strokePaint, currentStyle.strokeOpacity*100, "stroke") - - svgCanvas.setPaint("fill", fill) - svgCanvas.setPaint("stroke", stroke) - - addToHistory(new ChangeElementCommand(target, changes)); + svgEditor.paintBox.fill.update(true) + svgEditor.paintBox.stroke.update(true) + addToHistory(batchCmd); } } }, diff --git a/editor/extensions/ext-grid.js b/editor/extensions/ext-grid.js index 8f506fb..5cd01b5 100644 --- a/editor/extensions/ext-grid.js +++ b/editor/extensions/ext-grid.js @@ -20,7 +20,7 @@ svgEditor.addExtension("view_grid", function(s) { svgroot = s.svgroot; var showGrid = false; - var assignAttributes = svgCanvas.assignAttributes; + var assignAttributes = s.assignAttributes; var hcanvas = document.createElement('canvas'); $(hcanvas).hide().appendTo('body'); diff --git a/editor/extensions/ext-shapes.js b/editor/extensions/ext-shapes.js index cae41cb..6471334 100644 --- a/editor/extensions/ext-shapes.js +++ b/editor/extensions/ext-shapes.js @@ -103,7 +103,6 @@ svgEditor.addExtension("shapes", function() { } function makeButtons(cat, shapes) { - $('.tool_button, .tool_button_current').addClass("loaded") var size = cur_lib.size || 300; var fill = cur_lib.fill || false; var off = size * .05; diff --git a/editor/hover.js b/editor/hover.js new file mode 100644 index 0000000..afa8546 --- /dev/null +++ b/editor/hover.js @@ -0,0 +1,147 @@ +/** + * Package: svedit.select + * + * Licensed under the Apache License, Version 2 + * + * Copyright(c) 2010 Alexis Deveria + * Copyright(c) 2010 Jeff Schiller + */ + +// Dependencies: +// 1) jQuery +// 2) browser.js +// 3) math.js +// 4) svgutils.js + +var svgedit = svgedit || {}; + +(function() { + +if (!svgedit.hover) { + svgedit.hover = {}; +} + +var svgFactory_; +var config_; +var hoverManager_; // A Singleton + +// Class: svgedit.select.Selector +// Private class for DOM element selection boxes +// +// Parameters: +// id - integer to internally indentify the selector +// elem - DOM element associated with this selector +svgedit.hover.Hoverer = function(id, elem) { + // this is the selector's unique number + this.id = id; + + // this holds a reference to the element for which this selector is being used + this.hoveredElement = elem; + + // this is a flag used internally to track whether the selector is being used or not + this.locked = true; + + // this holds a reference to the element that holds all visual elements of the selector + this.hoverGroup = svgFactory_.createSVGElement({ + 'element': 'g', + 'attr': {'id': ('hoverGroup' + this.id)} + }); + + // this holds a reference to the path rect + this.hoverElem = this.selectorGroup.appendChild( + svgFactory_.createSVGElement({ + 'element': 'path', + 'attr': { + 'id': ('hoverBox' + this.id), + 'fill': 'none', + 'stroke': '#4F80FF', + 'stroke-width': '1', + 'shape-rendering': 'crispEdges', + 'style': 'pointer-events:none' + } + }) + ); + + + this.reset(this.hoveredElement); +}; + + +// Function: svgedit.select.Selector.reset +// Used to reset the id and element that the selector is attached to +// +// Parameters: +// e - DOM element associated with this selector +svgedit.hover.Hoverer.prototype.reset = function(e) { + this.locked = true; + this.hoveredElement = e; + this.resize(); + this.hoverGroup.setAttribute('display', 'inline'); +}; + + +// Class: svgedit.select.SelectorManager +svgedit.hover.HoverManager = function() { + // this will hold the element that contains all hover elements + this.hoverParentGroup = null; + this.initGroup(); +}; + +// Function: svgedit.select.SelectorManager.initGroup +// Resets the parent selector group element +svgedit.hover.HoverManager.prototype.initGroup = function() { + // remove old selector parent group if it existed + if (this.hoverParentGroup && this.hoverParentGroup.parentNode) { + this.hoverParentGroup.parentNode.removeChild(this.hoverParentGroup); + } + + // create parent selector group and add it to svgroot + this.selectorParentGroup = svgFactory_.createSVGElement({ + 'element': 'g', + 'attr': {'id': 'hoverParentGroup'} + }); + + + if($('#canvasBackground').length) return; + + var rect = svgFactory_.createSVGElement({ + 'element': 'rect', + 'attr': { + 'width': '100%', + 'height': '100%', + 'x': 0, + 'y': 0, + 'stroke-width': 1, + 'stroke': '#000', + 'fill': '#FFF', + 'shape-rendering': 'crispEdges', + 'style': 'pointer-events:none' + } + }); + + // Both Firefox and WebKit are too slow with this filter region (especially at higher + // zoom levels) and Opera has at least one bug +// if (!svgedit.browser.isOpera()) rect.setAttribute('filter', 'url(#canvashadow)'); + canvasbg.appendChild(rect); + svgFactory_.svgRoot().insertBefore(canvasbg, svgFactory_.svgContent()); +}; + + + +svgedit.hover.init = function(config, svgFactory) { + config_ = config; + svgFactory_ = svgFactory; + selectorManager_ = new svgedit.hover.HoverManager(); +}; + +/** + * Function: svgedit.select.getSelectorManager + * + * Returns: + * The SelectorManager instance. + */ +svgedit.hover.getHoverManager = function() { + return selectorManager_; +}; + +})(); \ No newline at end of file diff --git a/editor/svg-editor.css b/editor/svg-editor.css index 02c7b36..aff8673 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -1977,3 +1977,8 @@ span.zoom_tool img { #svg_editor #group_title {display: none;} +#base_unit_container { + display: none; + position: absolute; + z-index: 20; +} \ No newline at end of file diff --git a/editor/svg-editor.html b/editor/svg-editor.html index e29212b..e3c5df7 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -39,6 +39,7 @@ + @@ -48,6 +49,8 @@ + + @@ -87,7 +90,6 @@ $(function(){
-
@@ -182,6 +184,7 @@ $(function(){ @@ -787,18 +790,6 @@ $(function(){ @@ -809,6 +800,19 @@ $(function(){
+
+ +
+
diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 1e3e57b..3294b25 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -52,10 +52,10 @@ }, initOpacity: 1, imgPath: 'images/', - langPath: 'locale/', extPath: 'extensions/', jGraduatePath: 'jgraduate/images/', - extensions: ['ext-markers.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-grid.js'], + //extensions: ['ext-markers.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-grid.js'], + extensions: [], initTool: 'select', wireframe: false, colorPickerCSS: false, @@ -281,15 +281,6 @@ } }); }); - - var good_langs = []; - - $('#lang_select option').each(function() { - good_langs.push(this.value); - }); - - // var lang = ('lang' in curPrefs) ? curPrefs.lang : null; - Editor.putLocale(null, good_langs); } // Load extensions @@ -443,7 +434,7 @@ $('.toolbar_button button > svg, .toolbar_button button > img').each(function() { $(this).parent().prepend(this); }); - + $('.tool_button, .tool_button_current').addClass("loaded") var tleft = $('#tools_left'); if (tleft.length != 0) { var min_height = tleft.offset().top + tleft.outerHeight(); @@ -472,9 +463,27 @@ }, 1); } }); + + $('#rulers').on("dblclick", function(e){ + $("#base_unit_container").css({ + top: e.pageY-10, + left: e.pageX-50, + display: 'block' + }) + }) + $("#base_unit_container") + .on("mouseleave mouseenter", function(e){ + t = setTimeout(function(){$("#base_unit_container").fadeOut(500)}, 200) + if(event.type == "mouseover") clearTimeout(t) + }) + $("#base_unit") + .on("change", function(e) { + savePreferences(); + }); 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", @@ -500,8 +509,7 @@ zoomInIcon = 'crosshair', zoomOutIcon = 'crosshair', ui_context = 'toolbars', - orig_source = '', - paintBox = {fill: null, stroke:null}; + orig_source = ''; // This puts the correct shortcuts in the menus @@ -566,7 +574,6 @@ if(curr.length && curr[0].id !== 'tool_select') { curr.removeClass('tool_button_current').addClass('tool_button'); $('#tool_select').addClass('tool_button_current').removeClass('tool_button'); - $('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}'); } svgCanvas.setMode('select'); }; @@ -772,8 +779,8 @@ // In the event a gradient was flipped: if(selectedElement && mode === "select") { - paintBox.fill.update(); - paintBox.stroke.update(); + Editor.paintBox.fill.update(); + Editor.paintBox.stroke.update(); } svgCanvas.runExtensions("elementChanged", { @@ -853,8 +860,8 @@ // Makes sure the current selected paint is available to work with var prepPaints = function() { - paintBox.fill.prep(); - paintBox.stroke.prep(); + Editor.paintBox.fill.prep(); + Editor.paintBox.stroke.prep(); } var flyout_funcs = {}; @@ -1450,14 +1457,14 @@ $('#stroke_width').val(gWidth === null ? "" : gWidth); - paintBox.fill.update(true); - paintBox.stroke.update(true); + Editor.paintBox.fill.update(true); + Editor.paintBox.stroke.update(true); break; default: - paintBox.fill.update(true); - paintBox.stroke.update(true); + Editor.paintBox.fill.update(true); + Editor.paintBox.stroke.update(true); $('#stroke_width').val(selectedElement.getAttribute("stroke-width") || 1); $('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none"); @@ -1977,7 +1984,7 @@ paint = new $.jGraduate.Paint({alpha: 100, solidColor: color.substr(1)}); } - paintBox[picker].setPaint(paint); + Editor.paintBox[picker].setPaint(paint); if (isStroke) { svgCanvas.setColor('stroke', color); @@ -2728,8 +2735,8 @@ if (isNaN(fill_opacity)) {fill_opacity = 100;} var stroke = getPaint(stroke_color, stroke_opacity, "stroke"); var fill = getPaint(fill_color, fill_opacity, "fill"); - paintBox.fill.setPaint(stroke, true); - paintBox.stroke.setPaint(fill, true); + Editor.paintBox.fill.setPaint(stroke, true); + Editor.paintBox.stroke.setPaint(fill, true); }; @@ -2768,6 +2775,16 @@ updateWireFrame(); } + var clickSnapGrid = function() { + var sg = !$('#tool_snap').hasClass('push_button_pressed'); + if (sg) + $('#tool_snap').addClass('push_button_pressed'); + else + $('#tool_snap').removeClass('push_button_pressed'); + curConfig.gridSnapping = sg; + savePreferences(); + } + var clickCanvasColor = function(){ svgCanvas.clearSelection(); $('#tool_canvas').trigger("click") @@ -2946,17 +2963,12 @@ var color = $('#bg_blocks div.cur_background').css('background-color') || '#FFF'; setBackground(color, $('#canvas_bg_url').val()); - // set language - var lang = $('#lang_select').val(); - if(lang != curPrefs.lang) { - Editor.putLocale(lang); - } // set icon size setIconSize($('#iconsize').val()); // set grid setting - curConfig.gridSnapping = $('#grid_snapping_on')[0].checked; + curConfig.gridSnapping = $('#tool_snap').hasClass('push_button_pressed'); curConfig.snappingStep = $('#grid_snapping_step').val(); curConfig.showRulers = $('#show_rulers')[0].checked; @@ -3426,7 +3438,7 @@ var is_background = elem[0].id == "canvas_color" if (is_background) picker = 'canvas' // var opacity = (picker == 'stroke' ? $('#stroke_opacity') : $('#fill_opacity')); - var paint = paintBox[picker].paint; + var paint = Editor.paintBox[picker].paint; var title = (picker == 'stroke' ? 'Pick a Stroke Paint and Opacity' : 'Pick a Fill Paint and Opacity'); var was_none = false; @@ -3445,7 +3457,7 @@ function(p) { paint = new $.jGraduate.Paint(p); - paintBox[picker].setPaint(paint); + Editor.paintBox[picker].setPaint(paint); svgCanvas.setPaint(picker, paint); $('#color_picker').hide(); @@ -3649,19 +3661,19 @@ } }; - paintBox.fill = new PaintBox('#fill_color', 'fill'); - paintBox.stroke = new PaintBox('#stroke_color', 'stroke'); - paintBox.canvas = new PaintBox('#canvas_color', 'canvas'); + Editor.paintBox.fill = new PaintBox('#fill_color', 'fill'); + Editor.paintBox.stroke = new PaintBox('#stroke_color', 'stroke'); + Editor.paintBox.canvas = new PaintBox('#canvas_color', 'canvas'); $('#stroke_width').val(curConfig.initStroke.width); $('#group_opacity').val(curConfig.initOpacity * 100); // Use this SVG elem to test vectorEffect support - var test_el = paintBox.fill.rect.cloneNode(false); + var test_el = Editor.paintBox.fill.rect.cloneNode(false); test_el.setAttribute('style','vector-effect:non-scaling-stroke'); var supportsNonSS = (test_el.style.vectorEffect === 'non-scaling-stroke'); test_el.removeAttribute('style'); - var svgdocbox = paintBox.fill.rect.ownerDocument; + var svgdocbox = Editor.paintBox.fill.rect.ownerDocument; // Use this to test support for blur element. Seems to work to test support in Webkit var blur_test = svgdocbox.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur'); if(typeof blur_test.stdDeviationX === "undefined") { @@ -4100,6 +4112,7 @@ {sel:'#tool_import', fn: clickImport, evt: 'mouseup'}, {sel:'#tool_source', fn: showSourceEditor, evt: 'click', key: [modKey + 'U', true]}, {sel:'#tool_wireframe', fn: clickWireframe, evt: 'click'}, + {sel:'#tool_snap', fn: clickSnapGrid, evt: 'click'}, {sel:'#tool_rulers', fn: clickRulers, evt: 'click'}, {sel:'#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel', fn: cancelOverlays, evt: 'click', key: ['esc', false, false], hidekey: true}, {sel:'#tool_source_save', fn: saveSourceEditor, evt: 'click'}, diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 292b51b..9c68047 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -408,6 +408,8 @@ svgedit.select.init(curConfig, { }); // this object manages selectors for us var selectorManager = this.selectorManager = svgedit.select.getSelectorManager(); +// this object manages selectors for us +var hoverManager = this.hoverManager = svgedit.select.getSelectorManager(); // Import from path.js svgedit.path.init({ @@ -573,7 +575,8 @@ this.addExtension = function(name, ext_func) { svgroot: svgroot, svgcontent: svgcontent, nonce: getCurrentDrawing().getNonce(), - selectorManager: selectorManager + selectorManager: selectorManager, + hoverManager: hoverManager })); } else { var ext = ext_func; @@ -2370,7 +2373,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) { // but the action is not recorded until mousing up // - when we are in select mode, select the element, remember the position // and do nothing else - var mouseDown = function(evt) + var mouseDown = mosueOver = function(evt) { if(canvas.spaceKey || evt.button === 1) return; @@ -3159,6 +3162,18 @@ var getMouseTarget = this.getMouseTarget = function(evt) { }; // mouseMove() + + // mouseover mode + var mouseOver = function(evt) { + if (evt.button) return; + elem = evt.target; + var clone = elem.cloneNode(true); + clone.setAttribute("fill", "none"); + clone.setAttribute("stroke", "#09f") + clone.setAttribute("stroke-width", "1") + elem.selectorParentGroup.appendChild(clone) + } + // - in create mode, the element's opacity is set properly, we create an InsertElementCommand // and store it on the Undo stack // - in move/resize mode, the element's attributes which were affected by the move/resize are diff --git a/editor/svgedit.compiled.css b/editor/svgedit.compiled.css index 3a508df..2d3722f 100644 --- a/editor/svgedit.compiled.css +++ b/editor/svgedit.compiled.css @@ -411,6 +411,7 @@ span.zoom_tool img{vertical-align:top} .clearfix:after{clear:both} .clearfix{*zoom:1} #svg_editor #group_title{display:none} +#base_unit_container{display:none;position:absolute;z-index:20} INPUT.spin-button{padding:2px 20px 2px 2px;background-repeat:no-repeat;background-position:100% 0;background-image:url('spinbtn_updn.png');background-color:white} INPUT.spin-button.up{cursor:pointer;background-position:100% -18px} INPUT.spin-button.down{cursor:pointer;background-position:100% -36px} \ No newline at end of file diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 98f1e81..2698f5d 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,80 +1,81 @@ (function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?ga:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba= -S(U!==d?U:n[ta][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?ga:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",ga="fragment", -ta="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U, -Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra').hide().insertAfter("body")[0].contentWindow; -J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),ga=J(da);if(O!==da){M(da=O,ga);a(n).trigger("hashchange")}else if(ga!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ga;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ta+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,oa=0;oa0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba); -var S=Array(Math.floor((ba.length+2)/3)*4),U,sa,la,oa,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);sa=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);oa=U>>2;U=(U&3)<<4|sa>>4;Z=(sa&15)<<2|la>>6;Aa=la&63;if(isNaN(sa))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(oa);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]= -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka-1&&O.indexOf("Chrome/");var ta="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o); -o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){ga&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class", -"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);ga&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=ga?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa< -la;oa++){var Ka=sa[oa];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width", +106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ca){return typeof ca==="string"}function c(ca){var T=e.call(arguments,1);return function(){return ca.apply(this,T.concat(e.call(arguments)))}}function m(ca,T,V,sa,ta){var aa;if(sa!==d){T=V.match(ca?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);V=T[3]||"";if(ta===2&&f(sa))sa=sa.replace(ca?ga:ea,"");else{aa=q(T[2]);sa=f(sa)?q[ca?ha:Q](sa):sa;sa=ta===2?sa:ta===1?a.extend({},sa,aa):a.extend({},aa,sa);sa=u(sa);if(ca)sa=sa.replace(ra,l)}ca=T[1]+(ca?"#":sa||!T[1]?"?":"")+sa+V}else ca= +T(V!==d?V:n[ua][ia]);return ca}function o(ca,T,V){if(T===d||typeof T==="boolean"){V=T;T=u[ca?ha:Q]()}else T=f(T)?T.replace(ca?ga:ea,""):T;return q(T,V)}function b(ca,T,V,sa){if(!f(V)&&typeof V!=="object"){sa=V;V=T;T=d}return this.each(function(){var ta=a(this),aa=T||fa()[(this.nodeName||"").toLowerCase()]||"",ma=aa&&ta.attr(aa)||"";ta.attr(aa,u[ca](ma,V,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,q,M,U=a.bbq=a.bbq||{},P,K,fa,W=a.event.special,Q="querystring",ha="fragment", +ua="location",ia="href",ea=/^.*\?|#.*$/g,ga=/^.*\#/,ra,qa={};u[Q]=c(m,0,function(ca){return ca.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ha]=w=c(m,1,function(ca){return ca.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ca){ca=ca||"";ca=a.map(ca.split(""),encodeURIComponent);ra=RegExp(ca.join("|"),"g")};w.noEscape(",/");a.deparam=q=function(ca,T){var V={},sa={"true":true,"false":false,"null":null};a.each(ca.replace(/\+/g," ").split("&"),function(ta,aa){var ma=aa.split("="),Ga=l(ma[0]),Ma= +V,Ra=0,Qa=Ga.split("]["),Va=Qa.length-1;if(/\[/.test(Qa[0])&&/\]$/.test(Qa[Va])){Qa[Va]=Qa[Va].replace(/\]$/,"");Qa=Qa.shift().split("[").concat(Qa);Va=Qa.length-1}else Va=0;if(ma.length===2){ma=l(ma[1]);if(T)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?d:sa[ma]!==d?sa[ma]:ma;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; +K=function(){return c(U.document[b][d])};P=function(fa,W){if(fa!==W){var Q=U.document;Q.open().close();Q[b].hash="#"+fa}};P(c())}}var q={},M,U,P,K;q.start=function(){if(!M){var fa=c();P||w();(function W(){var Q=c(),ha=K(fa);if(Q!==fa){P(fa=Q,ha);a(n).trigger("hashchange")}else if(ha!==fa)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ha;M=setTimeout(W,a.hashchangeDelay)})()}};q.stop=function(){if(!U){M&&clearTimeout(M);M=0}};return q}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ca,T){if(ca!=="ajax"){if(fa)return;var V=(U=ia[0].contentDocument)&&U.getElementById("svg_eof");if(!V&&!(T&&V)){W++;if(W<50)setTimeout(o,20);else{d();fa=true}return}fa=true}M=a(U.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{V=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";P=a(new Image).attr({src:V,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} +function b(ca,T){if(!K){if(m.no_img)ca=false;if(ca){var V=a(document.createElement("div"));V.hide().appendTo("body")}if(T){var sa=m.fallback_path?m.fallback_path:"";a.each(T,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:sa+Xa,width:w,height:q,alt:"icon"});qa(Na,Va)})}else for(var ta=M.length,aa=0;aa0&&!ca)Ha=f(Ha,Na,true);ra(a(this),Ha,Xa)})});if(!T){ca&&V.remove();ia&&ia.remove();P&&P.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ca=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ca,m)}else m.fallback&&b(false,m.fallback)} +function e(ca){if(window.btoa)return window.btoa(ca);var T=Array(Math.floor((ca.length+2)/3)*4),V,sa,ta,aa,ma,Ga,Ma=0,Ra=0;do{V=ca.charCodeAt(Ma++);sa=ca.charCodeAt(Ma++);ta=ca.charCodeAt(Ma++);aa=V>>2;V=(V&3)<<4|sa>>4;ma=(sa&15)<<2|ta>>6;Ga=ta&63;if(isNaN(sa))ma=Ga=64;else if(isNaN(ta))Ga=64;T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(V);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); +T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&Q.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ia=a('').appendTo("body").hide();try{U=ia[0].contentDocument;ia.load(o); +o(0,true)}catch(ea){d()}}else{var ga=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ca){if(ca){U=ga.parseFromString(ca,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ca){if(window.opera)a(function(){d()});else if(ca.responseText){U=ga.parseFromString(ca.responseText,"text/xml");U.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ca,T,V,sa){ha&&T.css("visibility","hidden");if(m.replace){sa&&T.attr("id",V);(V=ca.attr("class"))&&T.attr("class", +"svg_icon "+V);ca.replaceWith(T)}else ca.append(T);ha&&setTimeout(function(){T.removeAttr("style")},1)},qa=function(ca,T){if(m.id_match===undefined||m.id_match!==false)ra(holder,ca,T,true);n[T]=ca};f=function(ca,T){var V=ca.find("defs");if(!V.length)return ca;V=ha?V.find("*").filter(function(){return!!this.id}):V.find("[id]");var sa=ca[0].getElementsByTagName("*"),ta=sa.length;V.each(function(aa){var ma=this.id;a(U).find("#"+ma);this.id=aa="x"+ma+T+aa;ma="url(#"+ma+")";var Ga="url(#"+aa+")";for(aa= +0;aa=0;jQuery.fn.jGraduate=function(c){var m= -arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ma*ga)+", 26)"},Cb);var Pa= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:Y,"fill-opacity":na,transform:"translate("+(10+ma*ga)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=nb;da.mousemove(l).mouseup(d);Ea=Kb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,hb=+aa.getAttribute("stop-opacity")|| -1,pb=aa.getAttribute("stop-color")||1,Db=(parseFloat(hb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=pb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){pb=cb.val("hex")?"#"+cb.val("hex"):"none";hb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",pb);Xa.setAttribute("fill-opacity",hb);aa.setAttribute("stop-color", -pb);aa.setAttribute("stop-opacity",hb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var hb=this.getAttribute("stop-color"),pb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",hb);Pa.setAttribute("fill",hb);aa.setAttribute("stop-opacity",pb===null?1:pb);Pa.setAttribute("fill-opacity", -pb===null?1:pb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){nb&&nb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");nb=ma;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(nb),Y=ma.data("stop");ma=ma.data("bg");$([nb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+ob+") ":"";qb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", -ma+"translate("+-Ma*(qb-1)+","+-ob*(Ja-1)+") scale("+qb+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>ga+10?ga+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/ga);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"), -aa=$(this);if(N
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('

    '+w.window.pickerTitle+'


    ');var ga=256,ta=ga-0,ha=ga-0,ca,ea,ra,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:ga,height:ga,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad"; -U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var oa=typeof w.newstop;if(oa==="string")switch(w.newstop){case "same":o(1,"#"+J,1);break;case "inverse":oa="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var Aa=(255-parseInt(J.substr(Z,2),16)).toString(16); -if(Aa.length<2)Aa=0+Aa;oa+=Aa}o(1,"#"+oa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(oa==="object")o(1,w.newstop.color||"#"+J,"opac"in w.newstop?w.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);oa=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")|| -Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ta,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*ga,left:J*ga}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*ga,left:Z*ga}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ga,left:Ka* -ga}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*ga,left:Na*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");pa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(Y[0]==="f"&&!rb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*ga)}).change()});var Ga,Cb,Kb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,qb=1,Ja=1,Za=0,Ma=Ka,ob=Ra;ab=a("svg",{width:"100%",height:45},Kb[0]);ba=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Kb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>ga+10?ga+10:Y;o(Y/ga,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var xb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod", -$(this).val())}),fb=null,ib=function(ma){var Y=ma.pageX-ub.left,na=ma.pageY-ub.top;Y=Y<0?0:Y>ga?ga:Y;na=na<0?0:na>ga?ga:na;fb.css("left",Y).css("top",na);Y/=ta;na/=ha;var K=fb.data("coord"),N=ea;switch(K){case "start":pa.x1.val(Y);pa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":pa.x2.val(Y);pa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":pa.cx.val(Y);pa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;ob=na;e();break;case "focus":pa.fx.val(Y); -pa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Lb=function(){fb=null;da.unbind("mousemove",ib).unbind("mouseup",Lb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z99.5)K=99.5;if(K>0)Ja=1-K/100;else qb=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX- -mb.offset.left-parseInt(mb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(mb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=qb=1;if(Y<0.5){Y/=0.5;qb=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}mb.elem.css({"margin-left":na}); -Y=Math.round(Y*100);mb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);mb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}}, -function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Mb=$(L+" .jGraduate_tabs li");Mb.click(function(){Mb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+ -(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=xb.val();ea.setAttribute("spreadMethod",Y)}rb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+ -p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Mb.removeClass("jGraduate_tab_current");var Nb;switch(u.paint.type){case "linearGradient":Nb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Nb=$(L+" .jGraduate_tab_radgrad");break;default:Nb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Nb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? +arguments;return this.each(function(){function o(na,ba,va,O,H){var Z=H||a("stop",{"stop-color":ba,"stop-opacity":va,offset:na},ga);if(H){ba=H.getAttribute("stop-color");va=H.getAttribute("stop-opacity");na=H.getAttribute("offset")}else ga.appendChild(Z);if(va===null)va=1;H=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+na*ha)+", 26)"},Ja);var Oa= +a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ba,"fill-opacity":va,transform:"translate("+(10+na*ha)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;fa.mousemove(l).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",Z).data("bg",H).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+Z.getAttribute("stop-opacity")|| +1,wb=Z.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ba=wb.substr(1)+xb;$("#"+q+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:ba,alphaSupport:true}},function(Db){wb=Db.val("hex")?"#"+Db.val("hex"):"none";fb=Db.val("a")!==null?Db.val("a")/256:1;Za.setAttribute("fill",wb);Za.setAttribute("fill-opacity",fb);Z.setAttribute("stop-color", +wb);Z.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()})});$(ga).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>na){if(!ba){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");Z.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Z.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", +wb===null?1:wb)}Za.before(Z);return false}});O&&b(Oa);return Z}function b(na){tb&&tb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");tb=na;tb.parentNode.appendChild(tb)}function d(){fa.unbind("mousemove",l);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var na=$(tb),ba=na.data("stop");na=na.data("bg");$([tb,ba,na]).remove()}$a=null}function e(){var na=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ga.removeAttribute("gradientTransform"):ga.setAttribute("gradientTransform", +na+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function l(na){var ba=na.pageX-Da.left;na=na.pageY-Da.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var va="translate("+ba+", 26)";if(na<-60||na>130){Ka.setAttribute("display","block");Ka.setAttribute("transform",va)}else Ka.setAttribute("display","none");$a.setAttribute("transform",va);$.data($a,"bg").setAttribute("transform",va);$.data($a,"stop").setAttribute("offset",(ba-10)/ha);var O=0;$(ga).find("stop").each(function(){var H=this.getAttribute("offset"), +Z=$(this);if(H
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var W=$(M+"> .jGraduate_colPick"),Q=$(M+"> .jGraduate_gradPick");Q.html('

    '+w.window.pickerTitle+'


    ');var ha=256,ua=ha-0,ia=ha-0,ea,ga,ra,qa={};$(".jGraduate_SliderBar").width(145);var ca=$("#"+q+"_jGraduate_GradContainer")[0],T=a("svg",{id:q+"_jgraduate_svg",width:ha,height:ha,xmlns:n.svg},ca);ea=ea||u.paint.type;var V=ga=u.paint[ea],sa=u.paint.alpha,ta=ea==="solidColor";switch(ea){case "solidColor":case "linearGradient":if(!ta){ga.id=q+"_lg_jgraduate_grad"; +V=ga=T.appendChild(ga)}a("radialGradient",{id:q+"_rg_jgraduate_grad"},T);if(ea==="linearGradient")break;case "radialGradient":if(!ta){ga.id=q+"_rg_jgraduate_grad";V=ga=T.appendChild(ga)}a("linearGradient",{id:q+"_lg_jgraduate_grad"},T)}if(ta){V=ga=$("#"+q+"_lg_jgraduate_grad")[0];K=u.paint[ea];o(0,"#"+K,1);var aa=typeof w.newstop;if(aa==="string")switch(w.newstop){case "same":o(1,"#"+K,1);break;case "inverse":aa="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ga=(255-parseInt(K.substr(ma,2),16)).toString(16); +if(Ga.length<2)Ga=0+Ga;aa+=Ga}o(1,"#"+aa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(aa==="object")o(1,w.newstop.color||"#"+K,"opac"in w.newstop?w.newstop.opac:1)}K=parseFloat(V.getAttribute("x1")||0);aa=parseFloat(V.getAttribute("y1")||0);ma=parseFloat(V.getAttribute("x2")||1);Ga=parseFloat(V.getAttribute("y2")||0);var Ma=parseFloat(V.getAttribute("cx")||0.5),Ra=parseFloat(V.getAttribute("cy")||0.5),Qa=parseFloat(V.getAttribute("fx")||Ma),Va=parseFloat(V.getAttribute("fy")|| +Ra);ra=a("rect",{id:q+"_jgraduate_rect",x:0,y:0,width:ua,height:ia,fill:"url(#"+q+"_jgraduate_grad)","fill-opacity":sa/100},T);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:aa*ha,left:K*ha}).data("coord","start").appendTo(ca),Na=Xa.clone().text(2).css({top:Ga*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(ca),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ha,left:Ma* +ha}).data("coord","center").appendTo(ca),Pa=Ha.clone().text("F").css({top:Va*ha,left:Qa*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ca);Pa[0].id=q+"_jGraduate_focusCoord";$(M+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,ba){var va=ga.getAttribute(ba),O=isNaN(ba[1]);va||(va=O?"0.5":ba==="x2"?"1.0":"0.0");qa[ba]=$("#"+q+"_jGraduate_"+ba).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ba[0]==="f"&&!jb))if(O&&ea==="radialGradient"||!O&&ea==="linearGradient")ga.setAttribute(ba,this.value);var H=O?ba[0]==="c"?Ha:Pa:ba[1]==="1"?Xa:Na,Z=ba.indexOf("x")>=0?"left":"top";H.css(Z,this.value*ha)}).change()});var zb,Ja,Jb=$("#"+q+"_jGraduate_StopSlider"),tb,ab,$a,Ka=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Da,yb=1,bb=1,Sa=0,gb=Ma,Ia=Ra;ab=a("svg",{width:"100%",height:45},Jb[0]);ca=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ca).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(na){Da=Jb.offset();if(na.target.tagName!=="path"){var ba=na.pageX-Da.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;o(ba/ha,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=Q.find(".jGraduate_spreadMethod").change(function(){ga.setAttribute("spreadMethod", +$(this).val())}),sb=null,mb=function(na){var ba=na.pageX-Wa.left,va=na.pageY-Wa.top;ba=ba<0?0:ba>ha?ha:ba;va=va<0?0:va>ha?ha:va;sb.css("left",ba).css("top",va);ba/=ua;va/=ia;var O=sb.data("coord"),H=ga;switch(O){case "start":qa.x1.val(ba);qa.y1.val(va);H.setAttribute("x1",ba);H.setAttribute("y1",va);break;case "end":qa.x2.val(ba);qa.y2.val(va);H.setAttribute("x2",ba);H.setAttribute("y2",va);break;case "center":qa.cx.val(ba);qa.cy.val(va);H.setAttribute("cx",ba);H.setAttribute("cy",va);gb=ba;Ia=va; +e();break;case "focus":qa.fx.val(ba);qa.fy.val(va);H.setAttribute("fx",ba);H.setAttribute("fy",va);e()}na.preventDefault()},hb=function(){sb=null;fa.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ga.getElementsByTagNameNS(n.svg,"stop");if(La<2){for(;La<2;){ga.appendChild(document.createElementNS(n.svg,"stop"));++La}zb=ga.getElementsByTagNameNS(n.svg,"stop")}var La=zb.length;for(ma=0;ma99.5)O=99.5;if(O>0)bb=1-O/100;else yb=-(O/100)-1;H=145*((O+100)/2)/100;Z&&e();break;case "angle":Sa=O;H=Sa/180;H+=0.5;H*=145;Z&&e()}if(H>145)H= +145;else if(H<0)H=0;va.css({"margin-left":H-5})}).change()});var Gb=function(na){var ba=na.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var va=ba-5;ba/=145;switch(nb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;ga.setAttribute("r",ba);break;case "opacity":u.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;case "ellip":bb=yb=1;if(ba<0.5){ba/=0.5;yb=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5; +ba=2-ba;bb=ba<=0?0.01:ba}e();ba-=1;if(bb===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Sa=ba*=180;e();ba/=100}nb.elem.css({"margin-left":va});ba=Math.round(ba*100);nb.input.val(ba);na.preventDefault()},Ob=function(){fa.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(Q=(u.paint.alpha*255/100).toString(16);Q.length<2;)Q="0"+Q;Q=Q.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+Q;ta||(K=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, +effects:{type:"show",speed:0}});W.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:K,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;U()},null,function(){P()});var Kb=$(M+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); +$(M+" > div").hide();var na=$(this).attr("data-type");$(M+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+q+"_jgraduate_rect")[0].setAttribute("fill","url(#"+q+"_"+na+"_jgraduate_grad)");ea=na==="lg"?"linearGradient":"radialGradient";$("#"+q+"_jGraduate_OpacInput").val(u.paint.alpha).change();var ba=$("#"+q+"_"+na+"_jgraduate_grad")[0];if(ga!==ba){var va=$(ga).find("stop");$(ba).empty().append(va); +ga=ba;ba=rb.val();ga.setAttribute("spreadMethod",ba)}jb=na==="rg"&&ga.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+q+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+q+"_jGraduate_match_ctr")[0].checked=false}else{$(M+" .jGraduate_gradPick").hide();$(M+" .jGraduate_colPick").show()}});$(M+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(u.paint.type){case "linearGradient":Ub=$(M+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(M+" .jGraduate_tab_radgrad");break; +default:Ub=$(M+" .jGraduate_tab_color")}u.show();setTimeout(function(){Ub.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!== null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?m=120)this.adjustValue(this.spinCfg.step);else f.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step);f.preventDefault()}).change(function(){this.adjustValue(0)});this.addEventListener&&this.addEventListener("DOMMouseScroll",function(f){if(f.detail>0)this.adjustValue(-this.spinCfg.step);else f.detail<0&&this.adjustValue(this.spinCfg.step);f.preventDefault()},false)})};function touchHandler(a){var n=a.changedTouches,f=n[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var m=document.createEvent("MouseEvent");m.initMouseEvent(c,true,true,window,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(n.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),n=$(document);$.extend($.fn,{contextMenu:function(f,c){if(f.menu==undefined)return false;if(f.inSpeed==undefined)f.inSpeed=150;if(f.outSpeed==undefined)f.outSpeed=75;if(f.inSpeed==0)f.inSpeed=-1;if(f.outSpeed==0)f.outSpeed=-1;$(this).each(function(){var m=$(this),o=$(m).offset(),b=$("#"+f.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).mouseup(function(e){var l=$(this);l.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||f.allowLeft|| -d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var u=e.pageX,w=e.pageY;e=a.width()-b.width();var p=a.height()-b.height();if(u>e-15)u=e-15;if(w>p-30)w=p-30;n.unbind("click");b.css({top:w,left:u}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(L){switch(L.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); +d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var u=e.pageX,w=e.pageY;e=a.width()-b.width();var q=a.height()-b.height();if(u>e-15)u=e-15;if(w>q-30)w=q-30;n.unbind("click");b.css({top:w,left:u}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(M){switch(M.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress"); $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:w-o.top,docX:u,docY:w});return false});setTimeout(function(){n.click(function(){n.unbind("click").unbind("keypress");b.fadeOut(f.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+f.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+f.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+f.menu).each(function(){$(this).bind("mousedown.disableTextSelect", function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>= -0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ta,0);return true}catch(ca){}return false}(),T=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ta, -0);return true}catch(ca){}return false}(),M=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);ha.setAttribute("x",5);ta.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ta);return ha===0}(),J=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ta.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ta);return ha.height>4&&ha.height<5}(),da=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca= -document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ta.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ta);return ha.width==15}(),V=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("x",0.1);(ta=ta.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return ta}(),O=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("style","vector-effect:non-scaling-stroke");return ta.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ta.appendItem(ha);return ta.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; -svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J}; -svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return ga}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +0,u="ontouchstart"in window,w=!!f.querySelector,q=!!document.evaluate,M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.replaceItem(ua,0);return true}catch(ea){}return false}(),U=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.insertItemBefore(ua, +0);return true}catch(ea){}return false}(),P=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ia.setAttribute("x",5);ua.appendChild(ia);var ea=document.createElementNS("http://www.w3.org/2000/svg","text");ea.textContent="a";ia.appendChild(ea);ia=ea.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ia===0}(),K=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg", +"svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(ua);return ia.height>4&&ia.height<5}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 10,0");var ea= +document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M5,0 15,0");var ga=document.createElementNS("http://www.w3.org/2000/svg","g");ga.appendChild(ia);ga.appendChild(ea);ua.appendChild(ga);ia=ga.getBBox();document.documentElement.removeChild(ua);return ia.width==15}(),W=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); +return ua}(),Q=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=f.createSVGTransform();ua.appendItem(ia);return ua.getItem(0)==ia}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; +svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return q};svgedit.browser.supportsPathReplaceItem=function(){return M};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return K}; +svgedit.browser.supportsHVLineContainerBBox=function(){return fa};svgedit.browser.supportsGoodTextCharPos=function(){return P};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return W};svgedit.browser.supportsNonScalingStroke=function(){return Q};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),n={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var o=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);o=this._xforms[m]=c;this._list._update()}return o};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],o=Array(this.numberOfItems- 1),b=0;b=0&&fn.x&&f.yn.y}})();svgedit=svgedit||{}; (function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,n);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("width","1em");d.setAttribute("height","1ex");d.setAttribute("x","1in");b.appendChild(d);d=d.getBBox();document.body.removeChild(b); b=d.x;m.em=d.width;m.ex=d.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var d=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(d);return parseFloat(b).toFixed(d)-0};svgedit.units.convertUnit=function(b,d){d=d||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[d])};svgedit.units.setUnitAttr=function(b, -d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var o={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(p){if(!l)if(RegExp("^-?[\\d\\.]+"+p+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); +d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var o={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(q){if(!l)if(RegExp("^-?[\\d\\.]+"+q+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); b=u==null||u===e}catch(w){}return b}else l=true;return l}})();svgedit=svgedit||{}; -(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var p=this.getBBox();if(!p.width||!p.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= +(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var q=this.getBBox();if(!q.width||!q.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= {};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,o=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();o=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); -var d=Array(Math.floor((b.length+2)/3)*4),e,l,u,w,p,L,T=0,M=0;do{e=b.charCodeAt(T++);l=b.charCodeAt(T++);u=b.charCodeAt(T++);w=e>>2;e=(e&3)<<4|l>>4;p=(l&15)<<2|u>>6;L=u&63;if(isNaN(l))p=L=64;else if(isNaN(u))L=64;d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(T< -b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,p="",L=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++)); -e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(p!=64)d+=String.fromCharCode(u)}while(L127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? +var d=Array(Math.floor((b.length+2)/3)*4),e,l,u,w,q,M,U=0,P=0;do{e=b.charCodeAt(U++);l=b.charCodeAt(U++);u=b.charCodeAt(U++);w=e>>2;e=(e&3)<<4|l>>4;q=(l&15)<<2|u>>6;M=u&63;if(isNaN(l))q=M=64;else if(isNaN(u))M=64;d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(M)}while(U< +b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,q="",M=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++)); +e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|q;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(q!=64)d+=String.fromCharCode(u)}while(M127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}}; svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0), -u=[l.x,l.y];for(l=0;l= 0){var l=e.split(":");b[l[1]]=n[l[0]]}else b[e]=e=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),w=u.nodeName, -p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,p)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){p=u[w].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0], -p[1])}m.removeAttribute("style")}}$.each(e,function(T,M){m.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(T,M){var J=m.getAttribute(M);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){m.setAttribute(M,"");m.removeAttribute(M)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{}; +q=u.localName,M=u.namespaceURI;if(!(d.hasOwnProperty(q)&&M==d[q]&&M!="http://www.w3.org/2000/xmlns/")&&!(M=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(M,q)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":q=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,q)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){q=u[w].split(":");b.indexOf(q[0])>=0&&m.setAttribute(q[0], +q[1])}m.removeAttribute("style")}}$.each(e,function(U,P){m.setAttributeNS("http://svg-edit.googlecode.com",P[0],P[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],function(U,P){var K=m.getAttribute(P);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(P,"");m.removeAttribute(P)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=f;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,n){this.elem=a;this.text=n||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= @@ -143,10 +144,10 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un (function(){if(!svgedit.select)svgedit.select={};var a,n,f;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));this.gripCoords={nw:null,n:null,ne:null,e:null, se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].setAttribute("style","cursor:"+m[c]+"-resize");c++}}; svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,o=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&& -!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var p=w.y,L=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,w*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;w=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); -u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;L=u.x;T=u.y;var M=u.x,J=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;M=p(M,p(e.tr.x,p(e.bl.x,e.br.x)))+l;J=p(J,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=M-L;T=J-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da]; -m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& +!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var q=w.y,M=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,q*e,M*e,w*e,d);d=e.aabox;u=d.x-l;q=d.y-l;M=d.width+l*2;var U=d.height+l*2;d=u+M/2;w=q+U/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); +u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;M=u.x;U=u.y;var P=u.x,K=u.y;u=Math.min;q=Math.max;M=u(M,u(e.tr.x,u(e.bl.x,e.br.x)))-l;U=u(U,u(e.tr.y,u(e.bl.y,e.br.y)))-l;P=q(P,q(e.tr.x,q(e.bl.x,e.br.x)))+l;K=q(K,q(e.tr.y,q(e.bl.y,e.br.y)))+l;u=M;q=U;M=P-M;U=K-U}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", +"M"+u+","+q+" L"+(u+M)+","+q+" "+(u+M)+","+(q+U)+" "+u+","+(q+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;q-=3.5;this.gripCoords={nw:[u,q],ne:[u+M,q],sw:[u,q+U],se:[u+M,q+U],n:[u+M/2,q],w:[u,q+U/2],e:[u+M,q+U/2],s:[u+M/2,q+U]};for(var fa in this.gripCoords){c=this.gripCoords[fa];o[fa].setAttribute("x",c[0]);o[fa].setAttribute("y",c[1])}this.rotateCoords={nw:[u,q],ne:[u+M+8,q],sw:[u,q+U+8],se:[u+M+8,q+U+8]};for(fa in this.rotateCoords){c=this.rotateCoords[fa]; +m.rotateGrips[fa].setAttribute("cx",c[0]);m.rotateGrips[fa].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var m=a.createSVGElement({element:"circle", attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}}); $.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});c.appendChild(m); @@ -168,362 +169,363 @@ c;o.appendChild(m);this.svgElem_.appendChild(o);this.identifyLayers();return o}; break}if(!o)return null;o.getAttribute("display");o.setAttribute("display",m?"inline":"none");return o};svgedit.draw.Drawing.prototype.getLayerOpacity=function(c){for(var m=0;m1))for(var o=0;o0){d=T0){d=U element";this.elem=d;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var d= -this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l=e?null:d[l+1],L=l-1<0?null:d[l-1];if(w.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(p){if(w.type!== -1){w.addGrip();if(p&&p.type!==2){w.next=p;w.next.prev=w}}}else if(w.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l=e?null:d[l+1],M=l-1<0?null:d[l-1];if(w.type===2){if(M&&M.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip()}u=l}else if(q&&q.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(q){if(w.type!== +1){w.addGrip();if(q&&q.type!==2){w.next=q;w.next.prev=w}}}else if(w.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l').documentElement, +$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",G=g.getAttribute(s);if(G&&G.indexOf("url(")===0){G=Z(G);if(G.tagName==="linearGradient"){var z=G.getAttribute("x1")||0,A=G.getAttribute("y1")||0,C=G.getAttribute("x2")||1,F=G.getAttribute("y2")||0;z=k.width*z+k.x;A=k.height*A+k.y;C=k.width*C+k.x;F=k.height*F+k.y;z=Q(z,A,h);F=Q(C,F,h);C={};C.x1=(z.x-k.x)/k.width;C.y1=(z.y-k.y)/k.height;C.x2=(F.x-k.x)/k.width;C.y2=(F.y-k.y)/k.height; +G=G.cloneNode(true);$(G).attr(C);G.id=O();Bb().appendChild(G);g.setAttribute(s,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('').documentElement, true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix= -function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};T.text=$.extend(true,{},T.shape);$.extend(T.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, -"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,ga=b.matrixMultiply=svgedit.math.matrixMultiply,ta=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform, -ca=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return qb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J}, -getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, -Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Wa=svgedit.history.ChangeElementCommand,Oa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();K("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== -Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&cc(h.elem)}else if(v==Wa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k= -v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}}); -svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},Kb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data, -ab=function(g){var h=$(g).attr(Kb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){vb().appendChild(yb[v]);delete yb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)B=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)B=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);B=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return B}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)}); -if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var B=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(B))D+=B/2;return D},C=[];$.each(g,function(F,B){var D=h(B);if(D){var H=t(B);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);C.push(D)}});k.x=E;k.y=z;$.each(g,function(F,B){var D=C[F];if(D&&B.nodeType==1){var H=t(B);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g|| -(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Mb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Nb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI, -g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ma(s));break;case 3:h.textContent=s.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref", -g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix); -z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);db("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(ob=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g); -K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],hb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},pb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var C= -t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(C-1));t.setAttribute("x2",-(F-1))}if(k.d<0){C=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(C-1));t.setAttribute("y2",-(F-1))}t.id=na();vb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=ga(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix, -k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,k));z.clear();z.appendItem(t)}else{z=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=z.x+Math.min(0,h.width);h.y=z.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry); -s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();break;case "line":z=O(h.x1,h.y1,k);C=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var B={};if(!isNaN(z)&& -!isNaN(t)&&z!=0&&t!=0&&h.x)B.x=h.x-(z-t);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)B.y=h.y-(C-F);if(B.x||B.y)oa(k[E],B,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h|| -h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ga(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ga(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k- -2);h.removeItem(k-2);h.appendItem(s)}}switch(g.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var E=$(g).data("gsvg");k=new Oa("Transform");var z={},t=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v= -["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var C=s.numberOfItems;z.points=Array(C);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var Q=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ua=h.getItem(G-1).matrix;C=g.childNodes;for(B=C.length;B--;){var wa=C.item(B);v=E=0;if(wa.nodeType==1){var fa=V(wa);if(fa){v=ha(fa).matrix;E=sa(wa);var ka=Za,qa=[];Za=wa.getAttribute("transform");if(E||ta(fa)){var za=e.createSVGTransform();za.setMatrix(ga(Q,W,ua,v));fa.clear();fa.appendItem(za);qa.push(za)}else{E=ga(v.inverse(),ua,v);za=e.createSVGMatrix(); -za.e=-E.e;za.f=-E.f;v=ga(za.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),zb=e.createSVGTransform(),Qb=e.createSVGTransform();jb.setTranslate(E.e,E.f);zb.setScale(v.a,v.d);Qb.setTranslate(za.e,za.f);fa.appendItem(Qb);fa.appendItem(zb);fa.appendItem(jb);qa.push(Qb);qa.push(zb);qa.push(jb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v); -h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=ga(v,E);E=v.e;v=v.f;if(E!=0||v!=0){C=g.childNodes;B=C.length;for(G=[];B--;){wa=C.item(B);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q, -0):fa.appendItem(Q);k.addSubCommand(cb(wa));fa=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=fa.length;Q--;){W=fa.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){E=ga(v,ha(fa).matrix);G=e.createSVGTransform();G.setMatrix(E); -fa.clear();fa.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems? -h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");fa=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,0):fa.appendItem(Q);k.addSubCommand(cb(wa));Za= -ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix; -za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=ga(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F1&&s.showGrips(false)}}}K("selected",J);h||J.length==1?Qa.requestSelector(J[0]).showGrips(true):Qa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3-(z.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]== -null;)J.shift(0)}},Pb=this.selectOnly=function(g,h){$a(true);Fb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(t){if(!(b.spaceKey|| -t.button===1)){var C=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Eb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;t.preventDefault();if(C)Ma="select";B=B/p;F=F/p;var D=$b(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=B,G=s=k=F;if(m.gridSnapping){B=Ga(B);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=nb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=nb(D,"dir")}else if(P=="resize"){Ma= -"resize";ob=nb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;ob="none";if(C)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Fb([D]);Lb=D;Ua.clear()}if(!C)for(C=0;C0&&b.removeFromSelection(D);H.length>0&&Fb(H);break;case "resize":D=V(C);H=(Q=ta(D))?E:svgedit.utilities.getBBox(C);G=H.x;W=H.y;var ua=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var fa=sa(C);if(fa){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-fa*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")== --1)H=0;var qa=ka=0,za=wa?(wa+P)/wa:1,jb=ua?(ua+H)/ua:1;if(ob.indexOf("n")>=0){za=wa?(wa-P)/wa:1;qa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-H)/ua:1;ka=ua}H=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);qa=Ga(qa)}H.setTranslate(-(G+ka),-(W+qa));if(t.shiftKey)if(jb==1)jb=za;else za=jb;P.setScale(jb,za);ua.setTranslate(G+ka,W+qa);if(Q){Q=fa?1:0;D.replaceItem(H,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua, -Q-3);D.replaceItem(P,Q-2);D.replaceItem(H,Q-1)}Qa.requestSelector(C).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;Q=y;if(t.shiftKey){Q=ca(h,k,G,Q);G=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(H);break; -case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);Q=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=Q=Math.max(H,Q);G=hk?k+W:k-W}if(t.altKey){Q=h;G=k;W=Math.abs(x-Q);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H, -z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t, -x,y);break;case "textedit":x*=p;y*=p;gb.mouseMove(B,F);break;case "rotate":H=svgedit.utilities.getBBox(C);Q=H.x+H.width/2;G=H.y+H.height/2;D=ea(C);D=O(Q,G,D);Q=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,Q-D)*(180/Math.PI)-90)%360;fa=(Math.atan2(G-y,Q-x)*(180/Math.PI)-90)%360;fa+=compensation_angle;if(m.gridSnapping)fa=Ga(fa);if(t.shiftKey)fa= -Math.round(fa/45)*45;b.setRotationAngle(fa<-180?360+fa:fa,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:B,mouse_y:F,selected:C})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var C=t.target.parentNode;if(C!==L){var F=$b(t),B=F.tagName;if(B==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Eb);gb.select(F,t.x,t.y)}if((B==="g"||B==="a")&&sa(F)){dc(F);F=J[0];$a(true)}L&&Sb();C.tagName!=="g"&&C.tagName!=="a"||C===w().getCurrentLayer()||F===Qa.selectorParentGroup|| -mc(F)}}).mouseup(function(t){if(t.button!==2){var C=Lb;Lb=null;if(Ja){var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=B/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");ub=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){B=J[0];switch(B.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ib.fill=B.getAttribute("fill");ib.fill_opacity=B.getAttribute("fill-opacity");ib.stroke=B.getAttribute("stroke"); -ib.stroke_opacity=B.getAttribute("stroke-opacity");ib.stroke_width=B.getAttribute("stroke-width");ib.stroke_dasharray=B.getAttribute("stroke-dasharray");ib.stroke_linejoin=B.getAttribute("stroke-linejoin");ib.stroke_linecap=B.getAttribute("stroke-linecap")}if(B.tagName=="text"){fb.font_size=B.getAttribute("font-size");fb.font_family=B.getAttribute("font-family")}Qa.requestSelector(B).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(B=0;B=0?C.indexOf(",",D+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":C=$(G).attr(["x1","x2","y1","y2"]);P=C.x1!=C.x2||C.y1!=C.y2;break;case "foreignObject":case "square":case "rect":case "image":C=$(G).attr(["width","height"]);P=C.width!=0||C.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":C=$(G).attr(["rx","ry"]);P=C.rx!=null||C.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"ellipse", -curStyles:true,attr:{cx:(z.minx+z.maxx)/2,cy:(z.miny+z.maxy)/2,rx:(z.maxx-z.minx)/2,ry:(z.maxy-z.miny)/2,id:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Pb([G]);gb.start(G);break;case "path":G=null;Ja=true;C=Ua.mouseUp(t,G,B,F);G=C.element;P=C.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t); -break;case "textedit":P=false;G=null;gb.mouseUp(t,B,F);break;case "rotate":P=true;G=null;Ma="select";C=b.undoMgr.finishUndoableChange();C.isEmpty()||Ia(C);Pa();K("changed",J)}B=sb("mouseUp",{event:t,mouse_x:B,mouse_y:F},true);$.each(B,function(ua,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(B=t.target;B.parentNode.parentNode.tagName=="g";)B=B.parentNode;if((Ma!="path"||!drawn_path)&&B.parentNode.id!="selectorParentGroup"&& -B.id!="svgcanvas"&&B.id!="svgroot"){b.setMode("select");Pb([B],true)}}else if(G!=null){b.addedNew=true;t=0.2;var Q;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){Q=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{Q[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){Q&&Q.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Pb([G],true);Ia(new Na(G));K("changed",[G])},t* -1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Eb=l.getScreenCTM().inverse();var C=O(t.pageX,t.pageY,Eb);C={x:C.x,y:C.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)C.factor=2;else{if(t.wheelDelta<=-120)C.factor=0.5}else if(t.detail)if(t.detail>0)C.factor=0.5;else if(t.detail<0)C.factor=2;C.factor&&K("zoomed",C)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},gb=b.textActions=function(){function g(fa){var ka=F.value=== -"";$(F).focus();if(!arguments.length)if(ka)fa=0;else{if(F.selectionEnd!==F.selectionStart)return;fa=F.selectionEnd}var qa;qa=G[fa];ka||F.setSelectionRange(fa,fa);B=la("text_cursor");if(!B){B=document.createElementNS(c,"line");oa(B,{id:"text_cursor",stroke:"#333","stroke-width":1});B=la("selectorParentGroup").appendChild(B)}H||(H=setInterval(function(){var za=B.getAttribute("display")==="none";B.setAttribute("display",za?"inline":"none")},600));ka=E(qa.x,P.y);qa=E(qa.x,P.y+P.height);oa(B,{x1:ka.x, -y1:ka.y,x2:qa.x,y2:qa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(fa,ka,qa){if(fa===ka)g(ka);else{qa||F.setSelectionRange(fa,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}fa=G[fa];var za=G[ka];B.setAttribute("visibility","hidden");ka=E(fa.x,P.y);qa=E(fa.x+(za.x-fa.x),P.y);var jb=E(fa.x,P.y+P.height);fa=E(fa.x+(za.x- -fa.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+qa.x+","+qa.y+" "+fa.x+","+fa.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(fa,ka){var qa=e.createSVGPoint();qa.x=fa;qa.y=ka;if(G.length==1)return 0;qa=C.getCharNumAtPosition(qa);if(qa<0){qa=G.length-2;if(fa<=G[0].x)qa=0}else if(qa>=G.length-2)qa=G.length-2;var za=G[qa];fa>za.x+za.width/2&&qa++;return qa}function v(fa,ka,qa){var za=F.selectionStart;fa=k(fa,ka);h(Math.min(za,fa),Math.max(za,fa),!qa)}function s(fa,ka){var qa={x:fa,y:ka};qa.x/= -p;qa.y/=p;if(Q){var za=O(qa.x,qa.y,Q.inverse());qa.x=za.x;qa.y=za.y}return qa}function E(fa,ka){var qa={x:fa,y:ka};if(Q){var za=O(qa.x,qa.y,Q);qa.x=za.x;qa.y=za.y}qa.x*=p;qa.y*=p;return qa}function z(fa){h(0,C.textContent.length);$(this).unbind(fa)}function t(fa){if(wa&&C){var ka=O(fa.pageX,fa.pageY,Eb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var qa=C.textContent,za=qa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;qa=qa.substr(ka).match(/^[a-z0-9]+/i);h(za,(qa?qa[0].length:0)+ka);$(fa.target).click(z); -setTimeout(function(){$(fa.target).unbind("click",z)},300)}}var C,F,B,D,H,G=[],P,Q,W,ua,wa;return{select:function(fa,ka,qa){C=fa;gb.toEditMode(ka,qa)},start:function(fa){C=fa;gb.toEditMode()},mouseDown:function(fa,ka,qa,za){fa=s(qa,za);F.focus();g(k(fa.x,fa.y));W=qa;ua=za},mouseMove:function(fa,ka){var qa=s(fa,ka);v(qa.x,qa.y)},mouseUp:function(fa,ka,qa){var za=s(ka,qa);v(za.x,za.y,true);fa.target!==C&&kaW-2&&qaua-2&&gb.toSelectMode(true)},setCursor:g,toEditMode:function(fa,ka){wa= -false;Ma="textedit";Qa.requestSelector(C).showGrips(false);Qa.requestSelector(C);gb.init();$(C).css("cursor","text");if(arguments.length){var qa=s(fa,ka);g(k(qa.x,qa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(fa){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");B&&$(B).attr("visibility","hidden");$(C).css("cursor","move");if(fa){$a();$(C).css("cursor","move");K("selected",[C]);Fb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur(); -C=false},setInputElem:function(fa){F=fa},clear:function(){Ma=="textedit"&&gb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=J[0];Qa.requestSelector(C).showGrips(false)}var fa=C.textContent.length,ka=C.getAttribute("transform");P=svgedit.utilities.getBBox(C);Q=ka?ea(C):null;G=Array(fa);F.focus();$(C).unbind("dblclick",t).dblclick(t);if(!fa)var qa={x:P.x+P.width/2,width:0};for(ka=0;ka=0&&this.selected_pts.push(C)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,C,F){if(Ma==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;t=mouse_y/p;C=la("path_stretch_line"); -k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!C){C=document.createElementNS(c,"path");oa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=la("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var B=null;if(s){B=s.pathSegList;for(var D=B.numberOfItems,H=6/p,G=false;D;){D--;var P=B.getItem(D),Q=P.x;P=P.y;if(F>=Q-H&&F<=Q+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);Q=B.numberOfItems; -if(G){if(D<=1&&Q>=2){F=B.getItem(0).x;t=B.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();B.appendItem(z);B.appendItem(F)}else if(Q<3)return B=false;$(C).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&pb(H,{},svgedit.path.path.matrix.inverse());C=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(H).remove(); -svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(z))){console.log("Clicked outside canvas");return false}B=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(B-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(mb(F),mb(t)):s.createSVGPathSegCurvetoCubicAbs(mb(F),mb(t),z.x1/p,z.y1/ -p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;C.setAttribute("d",["M",F,t,F,t].join(" "));C=B;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});C.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id; -if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[C,F];B=svgedit.path.path.segs[t];if(z.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=H.split("_")[1].split("c");t=z[0]- -0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,C){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var B=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");B.setAttribute("cx",t);B.setAttribute("cy",C);B.setAttribute("display","inline");B=k[0];var H=k[1];F.getItem(z);var G= -B+(B-t/p),P=H+(H-C/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:C,x2:B*p,y2:H*p,display:"inline"});oa(Q,{x1:G*p,y1:P*p,x2:B*p,y2:H*p,display:"inline"});if(z===0)v=[t,C];else{F=F.getItem(z-1);t=F.x;C=F.y;if(F.pathSegType===6){t+=t-F.x2;C+=C-F.y2}else if(v){t=v[0]/p;C=v[1]/p}svgedit.path.replacePathSeg(6,z,[B,H,t,C,G,P],s)}}else if(B=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType=== -6)svgedit.path.replacePathSeg(6,1,[t,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,C],B);else v?svgedit.path.replacePathSeg(6,1,[t,C,v[0],v[1],t,C],B):svgedit.path.replacePathSeg(4,1,[t,C],B)}}}else if(svgedit.path.path.dragging){B=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);H=svgedit.path.getPointFromGrip({x:t,y:C},svgedit.path.path);z=H.x-B.x;B=H.y-B.y;svgedit.path.path.dragging=[t,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z, -B):svgedit.path.path.movePts(z,B)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging= -false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(C)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox= -svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Fb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"), -C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,C));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Fb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z== -null||z.nodeName!="path")return false;var t=V(z),C=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,B=0;B0){H=F.getItem(B-1).pathSegType;if(H===2){D(B-1,1);C();break}else if(H=== -1&&F.numberOfItems-1===B){D(B,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){z=$(svgedit.path.path.elem);z.attr("d",z.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(z){var t=z.points,C=t.numberOfItems;if(C>=4){var F=t.getItem(0),B=null;z=[];z.push(["M",F.x,",", -F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(B)if((F=svgedit.path.smoothControlPoints(B,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;B=G}for(z.push("L");D0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){Sb();Pb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s=0;C--){t=z.item(C); -D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(qb.apply&&g.nodeName==="image"&&t.localName==="href"&&qb.images&&qb.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D); -k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push(" @@ -87,7 +90,6 @@ $(function(){

    -
    @@ -182,6 +184,7 @@ $(function(){ @@ -787,18 +790,6 @@ $(function(){ @@ -809,6 +800,19 @@ $(function(){
    +
    + +
    +
    diff --git a/method-draw/svg-editor.js b/method-draw/svg-editor.js index 1e3e57b..3294b25 100644 --- a/method-draw/svg-editor.js +++ b/method-draw/svg-editor.js @@ -52,10 +52,10 @@ }, initOpacity: 1, imgPath: 'images/', - langPath: 'locale/', extPath: 'extensions/', jGraduatePath: 'jgraduate/images/', - extensions: ['ext-markers.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-grid.js'], + //extensions: ['ext-markers.js', 'ext-eyedropper.js', 'ext-shapes.js', 'ext-grid.js'], + extensions: [], initTool: 'select', wireframe: false, colorPickerCSS: false, @@ -281,15 +281,6 @@ } }); }); - - var good_langs = []; - - $('#lang_select option').each(function() { - good_langs.push(this.value); - }); - - // var lang = ('lang' in curPrefs) ? curPrefs.lang : null; - Editor.putLocale(null, good_langs); } // Load extensions @@ -443,7 +434,7 @@ $('.toolbar_button button > svg, .toolbar_button button > img').each(function() { $(this).parent().prepend(this); }); - + $('.tool_button, .tool_button_current').addClass("loaded") var tleft = $('#tools_left'); if (tleft.length != 0) { var min_height = tleft.offset().top + tleft.outerHeight(); @@ -472,9 +463,27 @@ }, 1); } }); + + $('#rulers').on("dblclick", function(e){ + $("#base_unit_container").css({ + top: e.pageY-10, + left: e.pageX-50, + display: 'block' + }) + }) + $("#base_unit_container") + .on("mouseleave mouseenter", function(e){ + t = setTimeout(function(){$("#base_unit_container").fadeOut(500)}, 200) + if(event.type == "mouseover") clearTimeout(t) + }) + $("#base_unit") + .on("change", function(e) { + savePreferences(); + }); 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", @@ -500,8 +509,7 @@ zoomInIcon = 'crosshair', zoomOutIcon = 'crosshair', ui_context = 'toolbars', - orig_source = '', - paintBox = {fill: null, stroke:null}; + orig_source = ''; // This puts the correct shortcuts in the menus @@ -566,7 +574,6 @@ if(curr.length && curr[0].id !== 'tool_select') { curr.removeClass('tool_button_current').addClass('tool_button'); $('#tool_select').addClass('tool_button_current').removeClass('tool_button'); - $('#styleoverrides').text('#svgcanvas svg *{cursor:move;pointer-events:all} #svgcanvas svg{cursor:default}'); } svgCanvas.setMode('select'); }; @@ -772,8 +779,8 @@ // In the event a gradient was flipped: if(selectedElement && mode === "select") { - paintBox.fill.update(); - paintBox.stroke.update(); + Editor.paintBox.fill.update(); + Editor.paintBox.stroke.update(); } svgCanvas.runExtensions("elementChanged", { @@ -853,8 +860,8 @@ // Makes sure the current selected paint is available to work with var prepPaints = function() { - paintBox.fill.prep(); - paintBox.stroke.prep(); + Editor.paintBox.fill.prep(); + Editor.paintBox.stroke.prep(); } var flyout_funcs = {}; @@ -1450,14 +1457,14 @@ $('#stroke_width').val(gWidth === null ? "" : gWidth); - paintBox.fill.update(true); - paintBox.stroke.update(true); + Editor.paintBox.fill.update(true); + Editor.paintBox.stroke.update(true); break; default: - paintBox.fill.update(true); - paintBox.stroke.update(true); + Editor.paintBox.fill.update(true); + Editor.paintBox.stroke.update(true); $('#stroke_width').val(selectedElement.getAttribute("stroke-width") || 1); $('#stroke_style').val(selectedElement.getAttribute("stroke-dasharray")||"none"); @@ -1977,7 +1984,7 @@ paint = new $.jGraduate.Paint({alpha: 100, solidColor: color.substr(1)}); } - paintBox[picker].setPaint(paint); + Editor.paintBox[picker].setPaint(paint); if (isStroke) { svgCanvas.setColor('stroke', color); @@ -2728,8 +2735,8 @@ if (isNaN(fill_opacity)) {fill_opacity = 100;} var stroke = getPaint(stroke_color, stroke_opacity, "stroke"); var fill = getPaint(fill_color, fill_opacity, "fill"); - paintBox.fill.setPaint(stroke, true); - paintBox.stroke.setPaint(fill, true); + Editor.paintBox.fill.setPaint(stroke, true); + Editor.paintBox.stroke.setPaint(fill, true); }; @@ -2768,6 +2775,16 @@ updateWireFrame(); } + var clickSnapGrid = function() { + var sg = !$('#tool_snap').hasClass('push_button_pressed'); + if (sg) + $('#tool_snap').addClass('push_button_pressed'); + else + $('#tool_snap').removeClass('push_button_pressed'); + curConfig.gridSnapping = sg; + savePreferences(); + } + var clickCanvasColor = function(){ svgCanvas.clearSelection(); $('#tool_canvas').trigger("click") @@ -2946,17 +2963,12 @@ var color = $('#bg_blocks div.cur_background').css('background-color') || '#FFF'; setBackground(color, $('#canvas_bg_url').val()); - // set language - var lang = $('#lang_select').val(); - if(lang != curPrefs.lang) { - Editor.putLocale(lang); - } // set icon size setIconSize($('#iconsize').val()); // set grid setting - curConfig.gridSnapping = $('#grid_snapping_on')[0].checked; + curConfig.gridSnapping = $('#tool_snap').hasClass('push_button_pressed'); curConfig.snappingStep = $('#grid_snapping_step').val(); curConfig.showRulers = $('#show_rulers')[0].checked; @@ -3426,7 +3438,7 @@ var is_background = elem[0].id == "canvas_color" if (is_background) picker = 'canvas' // var opacity = (picker == 'stroke' ? $('#stroke_opacity') : $('#fill_opacity')); - var paint = paintBox[picker].paint; + var paint = Editor.paintBox[picker].paint; var title = (picker == 'stroke' ? 'Pick a Stroke Paint and Opacity' : 'Pick a Fill Paint and Opacity'); var was_none = false; @@ -3445,7 +3457,7 @@ function(p) { paint = new $.jGraduate.Paint(p); - paintBox[picker].setPaint(paint); + Editor.paintBox[picker].setPaint(paint); svgCanvas.setPaint(picker, paint); $('#color_picker').hide(); @@ -3649,19 +3661,19 @@ } }; - paintBox.fill = new PaintBox('#fill_color', 'fill'); - paintBox.stroke = new PaintBox('#stroke_color', 'stroke'); - paintBox.canvas = new PaintBox('#canvas_color', 'canvas'); + Editor.paintBox.fill = new PaintBox('#fill_color', 'fill'); + Editor.paintBox.stroke = new PaintBox('#stroke_color', 'stroke'); + Editor.paintBox.canvas = new PaintBox('#canvas_color', 'canvas'); $('#stroke_width').val(curConfig.initStroke.width); $('#group_opacity').val(curConfig.initOpacity * 100); // Use this SVG elem to test vectorEffect support - var test_el = paintBox.fill.rect.cloneNode(false); + var test_el = Editor.paintBox.fill.rect.cloneNode(false); test_el.setAttribute('style','vector-effect:non-scaling-stroke'); var supportsNonSS = (test_el.style.vectorEffect === 'non-scaling-stroke'); test_el.removeAttribute('style'); - var svgdocbox = paintBox.fill.rect.ownerDocument; + var svgdocbox = Editor.paintBox.fill.rect.ownerDocument; // Use this to test support for blur element. Seems to work to test support in Webkit var blur_test = svgdocbox.createElementNS('http://www.w3.org/2000/svg', 'feGaussianBlur'); if(typeof blur_test.stdDeviationX === "undefined") { @@ -4100,6 +4112,7 @@ {sel:'#tool_import', fn: clickImport, evt: 'mouseup'}, {sel:'#tool_source', fn: showSourceEditor, evt: 'click', key: [modKey + 'U', true]}, {sel:'#tool_wireframe', fn: clickWireframe, evt: 'click'}, + {sel:'#tool_snap', fn: clickSnapGrid, evt: 'click'}, {sel:'#tool_rulers', fn: clickRulers, evt: 'click'}, {sel:'#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel', fn: cancelOverlays, evt: 'click', key: ['esc', false, false], hidekey: true}, {sel:'#tool_source_save', fn: saveSourceEditor, evt: 'click'}, diff --git a/method-draw/svgcanvas.js b/method-draw/svgcanvas.js index 292b51b..9c68047 100644 --- a/method-draw/svgcanvas.js +++ b/method-draw/svgcanvas.js @@ -408,6 +408,8 @@ svgedit.select.init(curConfig, { }); // this object manages selectors for us var selectorManager = this.selectorManager = svgedit.select.getSelectorManager(); +// this object manages selectors for us +var hoverManager = this.hoverManager = svgedit.select.getSelectorManager(); // Import from path.js svgedit.path.init({ @@ -573,7 +575,8 @@ this.addExtension = function(name, ext_func) { svgroot: svgroot, svgcontent: svgcontent, nonce: getCurrentDrawing().getNonce(), - selectorManager: selectorManager + selectorManager: selectorManager, + hoverManager: hoverManager })); } else { var ext = ext_func; @@ -2370,7 +2373,7 @@ var getMouseTarget = this.getMouseTarget = function(evt) { // but the action is not recorded until mousing up // - when we are in select mode, select the element, remember the position // and do nothing else - var mouseDown = function(evt) + var mouseDown = mosueOver = function(evt) { if(canvas.spaceKey || evt.button === 1) return; @@ -3159,6 +3162,18 @@ var getMouseTarget = this.getMouseTarget = function(evt) { }; // mouseMove() + + // mouseover mode + var mouseOver = function(evt) { + if (evt.button) return; + elem = evt.target; + var clone = elem.cloneNode(true); + clone.setAttribute("fill", "none"); + clone.setAttribute("stroke", "#09f") + clone.setAttribute("stroke-width", "1") + elem.selectorParentGroup.appendChild(clone) + } + // - in create mode, the element's opacity is set properly, we create an InsertElementCommand // and store it on the Undo stack // - in move/resize mode, the element's attributes which were affected by the move/resize are diff --git a/method-draw/svgedit.compiled.css b/method-draw/svgedit.compiled.css index 3a508df..2d3722f 100644 --- a/method-draw/svgedit.compiled.css +++ b/method-draw/svgedit.compiled.css @@ -411,6 +411,7 @@ span.zoom_tool img{vertical-align:top} .clearfix:after{clear:both} .clearfix{*zoom:1} #svg_editor #group_title{display:none} +#base_unit_container{display:none;position:absolute;z-index:20} INPUT.spin-button{padding:2px 20px 2px 2px;background-repeat:no-repeat;background-position:100% 0;background-image:url('spinbtn_updn.png');background-color:white} INPUT.spin-button.up{cursor:pointer;background-position:100% -18px} INPUT.spin-button.down{cursor:pointer;background-position:100% -36px} \ No newline at end of file diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 98f1e81..2698f5d 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -1,80 +1,81 @@ (function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?ga:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba= -S(U!==d?U:n[ta][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?ga:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",ga="fragment", -ta="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U, -Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra').hide().insertAfter("body")[0].contentWindow; -J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),ga=J(da);if(O!==da){M(da=O,ga);a(n).trigger("hashchange")}else if(ga!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ga;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ta+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,oa=0;oa0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba); -var S=Array(Math.floor((ba.length+2)/3)*4),U,sa,la,oa,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);sa=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);oa=U>>2;U=(U&3)<<4|sa>>4;Z=(sa&15)<<2|la>>6;Aa=la&63;if(isNaN(sa))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(oa);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]= -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka-1&&O.indexOf("Chrome/");var ta="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o); -o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){ga&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class", -"svg_icon "+U);ba.replaceWith(S)}else ba.append(S);ga&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=ga?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa< -la;oa++){var Ka=sa[oa];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width", +106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ca){return typeof ca==="string"}function c(ca){var T=e.call(arguments,1);return function(){return ca.apply(this,T.concat(e.call(arguments)))}}function m(ca,T,V,sa,ta){var aa;if(sa!==d){T=V.match(ca?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);V=T[3]||"";if(ta===2&&f(sa))sa=sa.replace(ca?ga:ea,"");else{aa=q(T[2]);sa=f(sa)?q[ca?ha:Q](sa):sa;sa=ta===2?sa:ta===1?a.extend({},sa,aa):a.extend({},aa,sa);sa=u(sa);if(ca)sa=sa.replace(ra,l)}ca=T[1]+(ca?"#":sa||!T[1]?"?":"")+sa+V}else ca= +T(V!==d?V:n[ua][ia]);return ca}function o(ca,T,V){if(T===d||typeof T==="boolean"){V=T;T=u[ca?ha:Q]()}else T=f(T)?T.replace(ca?ga:ea,""):T;return q(T,V)}function b(ca,T,V,sa){if(!f(V)&&typeof V!=="object"){sa=V;V=T;T=d}return this.each(function(){var ta=a(this),aa=T||fa()[(this.nodeName||"").toLowerCase()]||"",ma=aa&&ta.attr(aa)||"";ta.attr(aa,u[ca](ma,V,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,q,M,U=a.bbq=a.bbq||{},P,K,fa,W=a.event.special,Q="querystring",ha="fragment", +ua="location",ia="href",ea=/^.*\?|#.*$/g,ga=/^.*\#/,ra,qa={};u[Q]=c(m,0,function(ca){return ca.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ha]=w=c(m,1,function(ca){return ca.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ca){ca=ca||"";ca=a.map(ca.split(""),encodeURIComponent);ra=RegExp(ca.join("|"),"g")};w.noEscape(",/");a.deparam=q=function(ca,T){var V={},sa={"true":true,"false":false,"null":null};a.each(ca.replace(/\+/g," ").split("&"),function(ta,aa){var ma=aa.split("="),Ga=l(ma[0]),Ma= +V,Ra=0,Qa=Ga.split("]["),Va=Qa.length-1;if(/\[/.test(Qa[0])&&/\]$/.test(Qa[Va])){Qa[Va]=Qa[Va].replace(/\]$/,"");Qa=Qa.shift().split("[").concat(Qa);Va=Qa.length-1}else Va=0;if(ma.length===2){ma=l(ma[1]);if(T)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?d:sa[ma]!==d?sa[ma]:ma;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; +K=function(){return c(U.document[b][d])};P=function(fa,W){if(fa!==W){var Q=U.document;Q.open().close();Q[b].hash="#"+fa}};P(c())}}var q={},M,U,P,K;q.start=function(){if(!M){var fa=c();P||w();(function W(){var Q=c(),ha=K(fa);if(Q!==fa){P(fa=Q,ha);a(n).trigger("hashchange")}else if(ha!==fa)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ha;M=setTimeout(W,a.hashchangeDelay)})()}};q.stop=function(){if(!U){M&&clearTimeout(M);M=0}};return q}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ca,T){if(ca!=="ajax"){if(fa)return;var V=(U=ia[0].contentDocument)&&U.getElementById("svg_eof");if(!V&&!(T&&V)){W++;if(W<50)setTimeout(o,20);else{d();fa=true}return}fa=true}M=a(U.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{V=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";P=a(new Image).attr({src:V,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} +function b(ca,T){if(!K){if(m.no_img)ca=false;if(ca){var V=a(document.createElement("div"));V.hide().appendTo("body")}if(T){var sa=m.fallback_path?m.fallback_path:"";a.each(T,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:sa+Xa,width:w,height:q,alt:"icon"});qa(Na,Va)})}else for(var ta=M.length,aa=0;aa0&&!ca)Ha=f(Ha,Na,true);ra(a(this),Ha,Xa)})});if(!T){ca&&V.remove();ia&&ia.remove();P&&P.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ca=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ca,m)}else m.fallback&&b(false,m.fallback)} +function e(ca){if(window.btoa)return window.btoa(ca);var T=Array(Math.floor((ca.length+2)/3)*4),V,sa,ta,aa,ma,Ga,Ma=0,Ra=0;do{V=ca.charCodeAt(Ma++);sa=ca.charCodeAt(Ma++);ta=ca.charCodeAt(Ma++);aa=V>>2;V=(V&3)<<4|sa>>4;ma=(sa&15)<<2|ta>>6;Ga=ta&63;if(isNaN(sa))ma=Ga=64;else if(isNaN(ta))Ga=64;T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(V);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); +T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&Q.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ia=a('').appendTo("body").hide();try{U=ia[0].contentDocument;ia.load(o); +o(0,true)}catch(ea){d()}}else{var ga=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ca){if(ca){U=ga.parseFromString(ca,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ca){if(window.opera)a(function(){d()});else if(ca.responseText){U=ga.parseFromString(ca.responseText,"text/xml");U.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ca,T,V,sa){ha&&T.css("visibility","hidden");if(m.replace){sa&&T.attr("id",V);(V=ca.attr("class"))&&T.attr("class", +"svg_icon "+V);ca.replaceWith(T)}else ca.append(T);ha&&setTimeout(function(){T.removeAttr("style")},1)},qa=function(ca,T){if(m.id_match===undefined||m.id_match!==false)ra(holder,ca,T,true);n[T]=ca};f=function(ca,T){var V=ca.find("defs");if(!V.length)return ca;V=ha?V.find("*").filter(function(){return!!this.id}):V.find("[id]");var sa=ca[0].getElementsByTagName("*"),ta=sa.length;V.each(function(aa){var ma=this.id;a(U).find("#"+ma);this.id=aa="x"+ma+T+aa;ma="url(#"+ma+")";var Ga="url(#"+aa+")";for(aa= +0;aa=0;jQuery.fn.jGraduate=function(c){var m= -arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ma*ga)+", 26)"},Cb);var Pa= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:Y,"fill-opacity":na,transform:"translate("+(10+ma*ga)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=nb;da.mousemove(l).mouseup(d);Ea=Kb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,hb=+aa.getAttribute("stop-opacity")|| -1,pb=aa.getAttribute("stop-color")||1,Db=(parseFloat(hb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=pb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){pb=cb.val("hex")?"#"+cb.val("hex"):"none";hb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",pb);Xa.setAttribute("fill-opacity",hb);aa.setAttribute("stop-color", -pb);aa.setAttribute("stop-opacity",hb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var hb=this.getAttribute("stop-color"),pb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",hb);Pa.setAttribute("fill",hb);aa.setAttribute("stop-opacity",pb===null?1:pb);Pa.setAttribute("fill-opacity", -pb===null?1:pb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){nb&&nb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");nb=ma;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(nb),Y=ma.data("stop");ma=ma.data("bg");$([nb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+ob+") ":"";qb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", -ma+"translate("+-Ma*(qb-1)+","+-ob*(Ja-1)+") scale("+qb+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>ga+10?ga+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/ga);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"), -aa=$(this);if(N
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('

    '+w.window.pickerTitle+'


    ');var ga=256,ta=ga-0,ha=ga-0,ca,ea,ra,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:ga,height:ga,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad"; -U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var oa=typeof w.newstop;if(oa==="string")switch(w.newstop){case "same":o(1,"#"+J,1);break;case "inverse":oa="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var Aa=(255-parseInt(J.substr(Z,2),16)).toString(16); -if(Aa.length<2)Aa=0+Aa;oa+=Aa}o(1,"#"+oa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(oa==="object")o(1,w.newstop.color||"#"+J,"opac"in w.newstop?w.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);oa=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")|| -Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ta,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*ga,left:J*ga}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*ga,left:Z*ga}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ga,left:Ka* -ga}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*ga,left:Na*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");pa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(Y[0]==="f"&&!rb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*ga)}).change()});var Ga,Cb,Kb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,qb=1,Ja=1,Za=0,Ma=Ka,ob=Ra;ab=a("svg",{width:"100%",height:45},Kb[0]);ba=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Kb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>ga+10?ga+10:Y;o(Y/ga,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var xb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod", -$(this).val())}),fb=null,ib=function(ma){var Y=ma.pageX-ub.left,na=ma.pageY-ub.top;Y=Y<0?0:Y>ga?ga:Y;na=na<0?0:na>ga?ga:na;fb.css("left",Y).css("top",na);Y/=ta;na/=ha;var K=fb.data("coord"),N=ea;switch(K){case "start":pa.x1.val(Y);pa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":pa.x2.val(Y);pa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":pa.cx.val(Y);pa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;ob=na;e();break;case "focus":pa.fx.val(Y); -pa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Lb=function(){fb=null;da.unbind("mousemove",ib).unbind("mouseup",Lb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z99.5)K=99.5;if(K>0)Ja=1-K/100;else qb=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX- -mb.offset.left-parseInt(mb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(mb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=qb=1;if(Y<0.5){Y/=0.5;qb=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}mb.elem.css({"margin-left":na}); -Y=Math.round(Y*100);mb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);mb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}}, -function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Mb=$(L+" .jGraduate_tabs li");Mb.click(function(){Mb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+ -(ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=xb.val();ea.setAttribute("spreadMethod",Y)}rb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+ -p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Mb.removeClass("jGraduate_tab_current");var Nb;switch(u.paint.type){case "linearGradient":Nb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Nb=$(L+" .jGraduate_tab_radgrad");break;default:Nb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Nb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? +arguments;return this.each(function(){function o(na,ba,va,O,H){var Z=H||a("stop",{"stop-color":ba,"stop-opacity":va,offset:na},ga);if(H){ba=H.getAttribute("stop-color");va=H.getAttribute("stop-opacity");na=H.getAttribute("offset")}else ga.appendChild(Z);if(va===null)va=1;H=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+na*ha)+", 26)"},Ja);var Oa= +a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ba,"fill-opacity":va,transform:"translate("+(10+na*ha)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;fa.mousemove(l).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",Z).data("bg",H).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+Z.getAttribute("stop-opacity")|| +1,wb=Z.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ba=wb.substr(1)+xb;$("#"+q+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:ba,alphaSupport:true}},function(Db){wb=Db.val("hex")?"#"+Db.val("hex"):"none";fb=Db.val("a")!==null?Db.val("a")/256:1;Za.setAttribute("fill",wb);Za.setAttribute("fill-opacity",fb);Z.setAttribute("stop-color", +wb);Z.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()})});$(ga).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>na){if(!ba){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");Z.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Z.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", +wb===null?1:wb)}Za.before(Z);return false}});O&&b(Oa);return Z}function b(na){tb&&tb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");tb=na;tb.parentNode.appendChild(tb)}function d(){fa.unbind("mousemove",l);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var na=$(tb),ba=na.data("stop");na=na.data("bg");$([tb,ba,na]).remove()}$a=null}function e(){var na=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ga.removeAttribute("gradientTransform"):ga.setAttribute("gradientTransform", +na+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function l(na){var ba=na.pageX-Da.left;na=na.pageY-Da.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var va="translate("+ba+", 26)";if(na<-60||na>130){Ka.setAttribute("display","block");Ka.setAttribute("transform",va)}else Ka.setAttribute("display","none");$a.setAttribute("transform",va);$.data($a,"bg").setAttribute("transform",va);$.data($a,"stop").setAttribute("offset",(ba-10)/ha);var O=0;$(ga).find("stop").each(function(){var H=this.getAttribute("offset"), +Z=$(this);if(H
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var W=$(M+"> .jGraduate_colPick"),Q=$(M+"> .jGraduate_gradPick");Q.html('

    '+w.window.pickerTitle+'


    ');var ha=256,ua=ha-0,ia=ha-0,ea,ga,ra,qa={};$(".jGraduate_SliderBar").width(145);var ca=$("#"+q+"_jGraduate_GradContainer")[0],T=a("svg",{id:q+"_jgraduate_svg",width:ha,height:ha,xmlns:n.svg},ca);ea=ea||u.paint.type;var V=ga=u.paint[ea],sa=u.paint.alpha,ta=ea==="solidColor";switch(ea){case "solidColor":case "linearGradient":if(!ta){ga.id=q+"_lg_jgraduate_grad"; +V=ga=T.appendChild(ga)}a("radialGradient",{id:q+"_rg_jgraduate_grad"},T);if(ea==="linearGradient")break;case "radialGradient":if(!ta){ga.id=q+"_rg_jgraduate_grad";V=ga=T.appendChild(ga)}a("linearGradient",{id:q+"_lg_jgraduate_grad"},T)}if(ta){V=ga=$("#"+q+"_lg_jgraduate_grad")[0];K=u.paint[ea];o(0,"#"+K,1);var aa=typeof w.newstop;if(aa==="string")switch(w.newstop){case "same":o(1,"#"+K,1);break;case "inverse":aa="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ga=(255-parseInt(K.substr(ma,2),16)).toString(16); +if(Ga.length<2)Ga=0+Ga;aa+=Ga}o(1,"#"+aa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(aa==="object")o(1,w.newstop.color||"#"+K,"opac"in w.newstop?w.newstop.opac:1)}K=parseFloat(V.getAttribute("x1")||0);aa=parseFloat(V.getAttribute("y1")||0);ma=parseFloat(V.getAttribute("x2")||1);Ga=parseFloat(V.getAttribute("y2")||0);var Ma=parseFloat(V.getAttribute("cx")||0.5),Ra=parseFloat(V.getAttribute("cy")||0.5),Qa=parseFloat(V.getAttribute("fx")||Ma),Va=parseFloat(V.getAttribute("fy")|| +Ra);ra=a("rect",{id:q+"_jgraduate_rect",x:0,y:0,width:ua,height:ia,fill:"url(#"+q+"_jgraduate_grad)","fill-opacity":sa/100},T);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:aa*ha,left:K*ha}).data("coord","start").appendTo(ca),Na=Xa.clone().text(2).css({top:Ga*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(ca),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ha,left:Ma* +ha}).data("coord","center").appendTo(ca),Pa=Ha.clone().text("F").css({top:Va*ha,left:Qa*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ca);Pa[0].id=q+"_jGraduate_focusCoord";$(M+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,ba){var va=ga.getAttribute(ba),O=isNaN(ba[1]);va||(va=O?"0.5":ba==="x2"?"1.0":"0.0");qa[ba]=$("#"+q+"_jGraduate_"+ba).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ba[0]==="f"&&!jb))if(O&&ea==="radialGradient"||!O&&ea==="linearGradient")ga.setAttribute(ba,this.value);var H=O?ba[0]==="c"?Ha:Pa:ba[1]==="1"?Xa:Na,Z=ba.indexOf("x")>=0?"left":"top";H.css(Z,this.value*ha)}).change()});var zb,Ja,Jb=$("#"+q+"_jGraduate_StopSlider"),tb,ab,$a,Ka=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Da,yb=1,bb=1,Sa=0,gb=Ma,Ia=Ra;ab=a("svg",{width:"100%",height:45},Jb[0]);ca=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ca).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(na){Da=Jb.offset();if(na.target.tagName!=="path"){var ba=na.pageX-Da.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;o(ba/ha,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=Q.find(".jGraduate_spreadMethod").change(function(){ga.setAttribute("spreadMethod", +$(this).val())}),sb=null,mb=function(na){var ba=na.pageX-Wa.left,va=na.pageY-Wa.top;ba=ba<0?0:ba>ha?ha:ba;va=va<0?0:va>ha?ha:va;sb.css("left",ba).css("top",va);ba/=ua;va/=ia;var O=sb.data("coord"),H=ga;switch(O){case "start":qa.x1.val(ba);qa.y1.val(va);H.setAttribute("x1",ba);H.setAttribute("y1",va);break;case "end":qa.x2.val(ba);qa.y2.val(va);H.setAttribute("x2",ba);H.setAttribute("y2",va);break;case "center":qa.cx.val(ba);qa.cy.val(va);H.setAttribute("cx",ba);H.setAttribute("cy",va);gb=ba;Ia=va; +e();break;case "focus":qa.fx.val(ba);qa.fy.val(va);H.setAttribute("fx",ba);H.setAttribute("fy",va);e()}na.preventDefault()},hb=function(){sb=null;fa.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ga.getElementsByTagNameNS(n.svg,"stop");if(La<2){for(;La<2;){ga.appendChild(document.createElementNS(n.svg,"stop"));++La}zb=ga.getElementsByTagNameNS(n.svg,"stop")}var La=zb.length;for(ma=0;ma99.5)O=99.5;if(O>0)bb=1-O/100;else yb=-(O/100)-1;H=145*((O+100)/2)/100;Z&&e();break;case "angle":Sa=O;H=Sa/180;H+=0.5;H*=145;Z&&e()}if(H>145)H= +145;else if(H<0)H=0;va.css({"margin-left":H-5})}).change()});var Gb=function(na){var ba=na.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var va=ba-5;ba/=145;switch(nb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;ga.setAttribute("r",ba);break;case "opacity":u.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;case "ellip":bb=yb=1;if(ba<0.5){ba/=0.5;yb=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5; +ba=2-ba;bb=ba<=0?0.01:ba}e();ba-=1;if(bb===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Sa=ba*=180;e();ba/=100}nb.elem.css({"margin-left":va});ba=Math.round(ba*100);nb.input.val(ba);na.preventDefault()},Ob=function(){fa.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(Q=(u.paint.alpha*255/100).toString(16);Q.length<2;)Q="0"+Q;Q=Q.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+Q;ta||(K=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, +effects:{type:"show",speed:0}});W.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:K,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;U()},null,function(){P()});var Kb=$(M+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); +$(M+" > div").hide();var na=$(this).attr("data-type");$(M+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+q+"_jgraduate_rect")[0].setAttribute("fill","url(#"+q+"_"+na+"_jgraduate_grad)");ea=na==="lg"?"linearGradient":"radialGradient";$("#"+q+"_jGraduate_OpacInput").val(u.paint.alpha).change();var ba=$("#"+q+"_"+na+"_jgraduate_grad")[0];if(ga!==ba){var va=$(ga).find("stop");$(ba).empty().append(va); +ga=ba;ba=rb.val();ga.setAttribute("spreadMethod",ba)}jb=na==="rg"&&ga.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+q+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+q+"_jGraduate_match_ctr")[0].checked=false}else{$(M+" .jGraduate_gradPick").hide();$(M+" .jGraduate_colPick").show()}});$(M+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(u.paint.type){case "linearGradient":Ub=$(M+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(M+" .jGraduate_tab_radgrad");break; +default:Ub=$(M+" .jGraduate_tab_color")}u.show();setTimeout(function(){Ub.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!== null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?m=120)this.adjustValue(this.spinCfg.step);else f.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step);f.preventDefault()}).change(function(){this.adjustValue(0)});this.addEventListener&&this.addEventListener("DOMMouseScroll",function(f){if(f.detail>0)this.adjustValue(-this.spinCfg.step);else f.detail<0&&this.adjustValue(this.spinCfg.step);f.preventDefault()},false)})};function touchHandler(a){var n=a.changedTouches,f=n[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var m=document.createEvent("MouseEvent");m.initMouseEvent(c,true,true,window,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(n.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),n=$(document);$.extend($.fn,{contextMenu:function(f,c){if(f.menu==undefined)return false;if(f.inSpeed==undefined)f.inSpeed=150;if(f.outSpeed==undefined)f.outSpeed=75;if(f.inSpeed==0)f.inSpeed=-1;if(f.outSpeed==0)f.outSpeed=-1;$(this).each(function(){var m=$(this),o=$(m).offset(),b=$("#"+f.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).mouseup(function(e){var l=$(this);l.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||f.allowLeft|| -d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var u=e.pageX,w=e.pageY;e=a.width()-b.width();var p=a.height()-b.height();if(u>e-15)u=e-15;if(w>p-30)w=p-30;n.unbind("click");b.css({top:w,left:u}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(L){switch(L.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); +d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var u=e.pageX,w=e.pageY;e=a.width()-b.width();var q=a.height()-b.height();if(u>e-15)u=e-15;if(w>q-30)w=q-30;n.unbind("click");b.css({top:w,left:u}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(M){switch(M.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress"); $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:w-o.top,docX:u,docY:w});return false});setTimeout(function(){n.click(function(){n.unbind("click").unbind("keypress");b.fadeOut(f.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+f.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+f.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+f.menu).each(function(){$(this).bind("mousedown.disableTextSelect", function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>= -0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ta,0);return true}catch(ca){}return false}(),T=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ta, -0);return true}catch(ca){}return false}(),M=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);ha.setAttribute("x",5);ta.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ta);return ha===0}(),J=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ta.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ta);return ha.height>4&&ha.height<5}(),da=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca= -document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ta.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ta);return ha.width==15}(),V=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("x",0.1);(ta=ta.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return ta}(),O=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("style","vector-effect:non-scaling-stroke");return ta.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ta.appendItem(ha);return ta.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; -svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J}; -svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return ga}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +0,u="ontouchstart"in window,w=!!f.querySelector,q=!!document.evaluate,M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.replaceItem(ua,0);return true}catch(ea){}return false}(),U=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.insertItemBefore(ua, +0);return true}catch(ea){}return false}(),P=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ia.setAttribute("x",5);ua.appendChild(ia);var ea=document.createElementNS("http://www.w3.org/2000/svg","text");ea.textContent="a";ia.appendChild(ea);ia=ea.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ia===0}(),K=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg", +"svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(ua);return ia.height>4&&ia.height<5}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 10,0");var ea= +document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M5,0 15,0");var ga=document.createElementNS("http://www.w3.org/2000/svg","g");ga.appendChild(ia);ga.appendChild(ea);ua.appendChild(ga);ia=ga.getBBox();document.documentElement.removeChild(ua);return ia.width==15}(),W=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); +return ua}(),Q=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=f.createSVGTransform();ua.appendItem(ia);return ua.getItem(0)==ia}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; +svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return q};svgedit.browser.supportsPathReplaceItem=function(){return M};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return K}; +svgedit.browser.supportsHVLineContainerBBox=function(){return fa};svgedit.browser.supportsGoodTextCharPos=function(){return P};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return W};svgedit.browser.supportsNonScalingStroke=function(){return Q};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),n={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var o=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);o=this._xforms[m]=c;this._list._update()}return o};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],o=Array(this.numberOfItems- 1),b=0;b=0&&fn.x&&f.yn.y}})();svgedit=svgedit||{}; (function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,n);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("width","1em");d.setAttribute("height","1ex");d.setAttribute("x","1in");b.appendChild(d);d=d.getBBox();document.body.removeChild(b); b=d.x;m.em=d.width;m.ex=d.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var d=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(d);return parseFloat(b).toFixed(d)-0};svgedit.units.convertUnit=function(b,d){d=d||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[d])};svgedit.units.setUnitAttr=function(b, -d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var o={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(p){if(!l)if(RegExp("^-?[\\d\\.]+"+p+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); +d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var o={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(q){if(!l)if(RegExp("^-?[\\d\\.]+"+q+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); b=u==null||u===e}catch(w){}return b}else l=true;return l}})();svgedit=svgedit||{}; -(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var p=this.getBBox();if(!p.width||!p.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= +(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var q=this.getBBox();if(!q.width||!q.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= {};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,o=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();o=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); -var d=Array(Math.floor((b.length+2)/3)*4),e,l,u,w,p,L,T=0,M=0;do{e=b.charCodeAt(T++);l=b.charCodeAt(T++);u=b.charCodeAt(T++);w=e>>2;e=(e&3)<<4|l>>4;p=(l&15)<<2|u>>6;L=u&63;if(isNaN(l))p=L=64;else if(isNaN(u))L=64;d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(T< -b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,p="",L=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++)); -e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(p!=64)d+=String.fromCharCode(u)}while(L127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? +var d=Array(Math.floor((b.length+2)/3)*4),e,l,u,w,q,M,U=0,P=0;do{e=b.charCodeAt(U++);l=b.charCodeAt(U++);u=b.charCodeAt(U++);w=e>>2;e=(e&3)<<4|l>>4;q=(l&15)<<2|u>>6;M=u&63;if(isNaN(l))q=M=64;else if(isNaN(u))M=64;d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(M)}while(U< +b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,q="",M=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++)); +e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|q;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(q!=64)d+=String.fromCharCode(u)}while(M127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}}; svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0), -u=[l.x,l.y];for(l=0;l= 0){var l=e.split(":");b[l[1]]=n[l[0]]}else b[e]=e=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),w=u.nodeName, -p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,p)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){p=u[w].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0], -p[1])}m.removeAttribute("style")}}$.each(e,function(T,M){m.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(T,M){var J=m.getAttribute(M);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){m.setAttribute(M,"");m.removeAttribute(M)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{}; +q=u.localName,M=u.namespaceURI;if(!(d.hasOwnProperty(q)&&M==d[q]&&M!="http://www.w3.org/2000/xmlns/")&&!(M=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(M,q)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":q=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,q)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){q=u[w].split(":");b.indexOf(q[0])>=0&&m.setAttribute(q[0], +q[1])}m.removeAttribute("style")}}$.each(e,function(U,P){m.setAttributeNS("http://svg-edit.googlecode.com",P[0],P[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],function(U,P){var K=m.getAttribute(P);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(P,"");m.removeAttribute(P)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=f;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,n){this.elem=a;this.text=n||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= @@ -143,10 +144,10 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un (function(){if(!svgedit.select)svgedit.select={};var a,n,f;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));this.gripCoords={nw:null,n:null,ne:null,e:null, se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].setAttribute("style","cursor:"+m[c]+"-resize");c++}}; svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,o=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&& -!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var p=w.y,L=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,w*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;w=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); -u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;L=u.x;T=u.y;var M=u.x,J=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;M=p(M,p(e.tr.x,p(e.bl.x,e.br.x)))+l;J=p(J,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=M-L;T=J-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da]; -m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& +!isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var q=w.y,M=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,q*e,M*e,w*e,d);d=e.aabox;u=d.x-l;q=d.y-l;M=d.width+l*2;var U=d.height+l*2;d=u+M/2;w=q+U/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); +u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;M=u.x;U=u.y;var P=u.x,K=u.y;u=Math.min;q=Math.max;M=u(M,u(e.tr.x,u(e.bl.x,e.br.x)))-l;U=u(U,u(e.tr.y,u(e.bl.y,e.br.y)))-l;P=q(P,q(e.tr.x,q(e.bl.x,e.br.x)))+l;K=q(K,q(e.tr.y,q(e.bl.y,e.br.y)))+l;u=M;q=U;M=P-M;U=K-U}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", +"M"+u+","+q+" L"+(u+M)+","+q+" "+(u+M)+","+(q+U)+" "+u+","+(q+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;q-=3.5;this.gripCoords={nw:[u,q],ne:[u+M,q],sw:[u,q+U],se:[u+M,q+U],n:[u+M/2,q],w:[u,q+U/2],e:[u+M,q+U/2],s:[u+M/2,q+U]};for(var fa in this.gripCoords){c=this.gripCoords[fa];o[fa].setAttribute("x",c[0]);o[fa].setAttribute("y",c[1])}this.rotateCoords={nw:[u,q],ne:[u+M+8,q],sw:[u,q+U+8],se:[u+M+8,q+U+8]};for(fa in this.rotateCoords){c=this.rotateCoords[fa]; +m.rotateGrips[fa].setAttribute("cx",c[0]);m.rotateGrips[fa].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var m=a.createSVGElement({element:"circle", attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}}); $.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});c.appendChild(m); @@ -168,362 +169,363 @@ c;o.appendChild(m);this.svgElem_.appendChild(o);this.identifyLayers();return o}; break}if(!o)return null;o.getAttribute("display");o.setAttribute("display",m?"inline":"none");return o};svgedit.draw.Drawing.prototype.getLayerOpacity=function(c){for(var m=0;m1))for(var o=0;o0){d=T0){d=U element";this.elem=d;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var d= -this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l=e?null:d[l+1],L=l-1<0?null:d[l-1];if(w.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(p){if(w.type!== -1){w.addGrip();if(p&&p.type!==2){w.next=p;w.next.prev=w}}}else if(w.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l=e?null:d[l+1],M=l-1<0?null:d[l-1];if(w.type===2){if(M&&M.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip()}u=l}else if(q&&q.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(q){if(w.type!== +1){w.addGrip();if(q&&q.type!==2){w.next=q;w.next.prev=w}}}else if(w.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l').documentElement, +$.SvgCanvas=function(a,n){function f(g,h){for(var k=svgedit.utilities.getBBox(g),v=0;v<2;v++){var s=v===0?"fill":"stroke",G=g.getAttribute(s);if(G&&G.indexOf("url(")===0){G=Z(G);if(G.tagName==="linearGradient"){var z=G.getAttribute("x1")||0,A=G.getAttribute("y1")||0,C=G.getAttribute("x2")||1,F=G.getAttribute("y2")||0;z=k.width*z+k.x;A=k.height*A+k.y;C=k.width*C+k.x;F=k.height*F+k.y;z=Q(z,A,h);F=Q(C,F,h);C={};C.x1=(z.x-k.x)/k.width;C.y1=(z.y-k.y)/k.height;C.x2=(F.x-k.x)/k.width;C.y2=(F.y-k.y)/k.height; +G=G.cloneNode(true);$(G).attr(C);G.id=O();Bb().appendChild(G);g.setAttribute(s,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};n&&$.extend(m,n);var o=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('').documentElement, true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix= -function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};T.text=$.extend(true,{},T.shape);$.extend(T.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, -"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,ga=b.matrixMultiply=svgedit.math.matrixMultiply,ta=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform, -ca=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return qb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J}, -getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, -Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Wa=svgedit.history.ChangeElementCommand,Oa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();K("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== -Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&cc(h.elem)}else if(v==Wa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k= -v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}}); -svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},Kb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data, -ab=function(g){var h=$(g).attr(Kb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){vb().appendChild(yb[v]);delete yb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)B=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)B=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);B=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return B}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)}); -if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var B=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(B))D+=B/2;return D},C=[];$.each(g,function(F,B){var D=h(B);if(D){var H=t(B);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);C.push(D)}});k.x=E;k.y=z;$.each(g,function(F,B){var D=C[F];if(D&&B.nodeType==1){var H=t(B);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g|| -(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Mb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Nb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI, -g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ma(s));break;case 3:h.textContent=s.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref", -g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix); -z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);db("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(ob=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g); -K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],hb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},pb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var C= -t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(C-1));t.setAttribute("x2",-(F-1))}if(k.d<0){C=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(C-1));t.setAttribute("y2",-(F-1))}t.id=na();vb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=ga(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix, -k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,k));z.clear();z.appendItem(t)}else{z=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=z.x+Math.min(0,h.width);h.y=z.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry); -s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();break;case "line":z=O(h.x1,h.y1,k);C=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var B={};if(!isNaN(z)&& -!isNaN(t)&&z!=0&&t!=0&&h.x)B.x=h.x-(z-t);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)B.y=h.y-(C-F);if(B.x||B.y)oa(k[E],B,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h|| -h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ga(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ga(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k- -2);h.removeItem(k-2);h.appendItem(s)}}switch(g.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var E=$(g).data("gsvg");k=new Oa("Transform");var z={},t=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v= -["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var C=s.numberOfItems;z.points=Array(C);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var Q=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ua=h.getItem(G-1).matrix;C=g.childNodes;for(B=C.length;B--;){var wa=C.item(B);v=E=0;if(wa.nodeType==1){var fa=V(wa);if(fa){v=ha(fa).matrix;E=sa(wa);var ka=Za,qa=[];Za=wa.getAttribute("transform");if(E||ta(fa)){var za=e.createSVGTransform();za.setMatrix(ga(Q,W,ua,v));fa.clear();fa.appendItem(za);qa.push(za)}else{E=ga(v.inverse(),ua,v);za=e.createSVGMatrix(); -za.e=-E.e;za.f=-E.f;v=ga(za.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),zb=e.createSVGTransform(),Qb=e.createSVGTransform();jb.setTranslate(E.e,E.f);zb.setScale(v.a,v.d);Qb.setTranslate(za.e,za.f);fa.appendItem(Qb);fa.appendItem(zb);fa.appendItem(jb);qa.push(Qb);qa.push(zb);qa.push(jb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v); -h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=ga(v,E);E=v.e;v=v.f;if(E!=0||v!=0){C=g.childNodes;B=C.length;for(G=[];B--;){wa=C.item(B);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q, -0):fa.appendItem(Q);k.addSubCommand(cb(wa));fa=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=fa.length;Q--;){W=fa.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){E=ga(v,ha(fa).matrix);G=e.createSVGTransform();G.setMatrix(E); -fa.clear();fa.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems? -h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");fa=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,0):fa.appendItem(Q);k.addSubCommand(cb(wa));Za= -ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix; -za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=ga(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F1&&s.showGrips(false)}}}K("selected",J);h||J.length==1?Qa.requestSelector(J[0]).showGrips(true):Qa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3-(z.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]== -null;)J.shift(0)}},Pb=this.selectOnly=function(g,h){$a(true);Fb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(t){if(!(b.spaceKey|| -t.button===1)){var C=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Eb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;t.preventDefault();if(C)Ma="select";B=B/p;F=F/p;var D=$b(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=B,G=s=k=F;if(m.gridSnapping){B=Ga(B);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=nb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=nb(D,"dir")}else if(P=="resize"){Ma= -"resize";ob=nb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;ob="none";if(C)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Fb([D]);Lb=D;Ua.clear()}if(!C)for(C=0;C0&&b.removeFromSelection(D);H.length>0&&Fb(H);break;case "resize":D=V(C);H=(Q=ta(D))?E:svgedit.utilities.getBBox(C);G=H.x;W=H.y;var ua=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var fa=sa(C);if(fa){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-fa*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")== --1)H=0;var qa=ka=0,za=wa?(wa+P)/wa:1,jb=ua?(ua+H)/ua:1;if(ob.indexOf("n")>=0){za=wa?(wa-P)/wa:1;qa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-H)/ua:1;ka=ua}H=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);qa=Ga(qa)}H.setTranslate(-(G+ka),-(W+qa));if(t.shiftKey)if(jb==1)jb=za;else za=jb;P.setScale(jb,za);ua.setTranslate(G+ka,W+qa);if(Q){Q=fa?1:0;D.replaceItem(H,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua, -Q-3);D.replaceItem(P,Q-2);D.replaceItem(H,Q-1)}Qa.requestSelector(C).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;Q=y;if(t.shiftKey){Q=ca(h,k,G,Q);G=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(H);break; -case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);Q=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=Q=Math.max(H,Q);G=hk?k+W:k-W}if(t.altKey){Q=h;G=k;W=Math.abs(x-Q);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H, -z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t, -x,y);break;case "textedit":x*=p;y*=p;gb.mouseMove(B,F);break;case "rotate":H=svgedit.utilities.getBBox(C);Q=H.x+H.width/2;G=H.y+H.height/2;D=ea(C);D=O(Q,G,D);Q=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,Q-D)*(180/Math.PI)-90)%360;fa=(Math.atan2(G-y,Q-x)*(180/Math.PI)-90)%360;fa+=compensation_angle;if(m.gridSnapping)fa=Ga(fa);if(t.shiftKey)fa= -Math.round(fa/45)*45;b.setRotationAngle(fa<-180?360+fa:fa,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:B,mouse_y:F,selected:C})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var C=t.target.parentNode;if(C!==L){var F=$b(t),B=F.tagName;if(B==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Eb);gb.select(F,t.x,t.y)}if((B==="g"||B==="a")&&sa(F)){dc(F);F=J[0];$a(true)}L&&Sb();C.tagName!=="g"&&C.tagName!=="a"||C===w().getCurrentLayer()||F===Qa.selectorParentGroup|| -mc(F)}}).mouseup(function(t){if(t.button!==2){var C=Lb;Lb=null;if(Ja){var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=B/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");ub=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){B=J[0];switch(B.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ib.fill=B.getAttribute("fill");ib.fill_opacity=B.getAttribute("fill-opacity");ib.stroke=B.getAttribute("stroke"); -ib.stroke_opacity=B.getAttribute("stroke-opacity");ib.stroke_width=B.getAttribute("stroke-width");ib.stroke_dasharray=B.getAttribute("stroke-dasharray");ib.stroke_linejoin=B.getAttribute("stroke-linejoin");ib.stroke_linecap=B.getAttribute("stroke-linecap")}if(B.tagName=="text"){fb.font_size=B.getAttribute("font-size");fb.font_family=B.getAttribute("font-family")}Qa.requestSelector(B).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(B=0;B=0?C.indexOf(",",D+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":C=$(G).attr(["x1","x2","y1","y2"]);P=C.x1!=C.x2||C.y1!=C.y2;break;case "foreignObject":case "square":case "rect":case "image":C=$(G).attr(["width","height"]);P=C.width!=0||C.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":C=$(G).attr(["rx","ry"]);P=C.rx!=null||C.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"ellipse", -curStyles:true,attr:{cx:(z.minx+z.maxx)/2,cy:(z.miny+z.maxy)/2,rx:(z.maxx-z.minx)/2,ry:(z.maxy-z.miny)/2,id:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Pb([G]);gb.start(G);break;case "path":G=null;Ja=true;C=Ua.mouseUp(t,G,B,F);G=C.element;P=C.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t); -break;case "textedit":P=false;G=null;gb.mouseUp(t,B,F);break;case "rotate":P=true;G=null;Ma="select";C=b.undoMgr.finishUndoableChange();C.isEmpty()||Ia(C);Pa();K("changed",J)}B=sb("mouseUp",{event:t,mouse_x:B,mouse_y:F},true);$.each(B,function(ua,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(B=t.target;B.parentNode.parentNode.tagName=="g";)B=B.parentNode;if((Ma!="path"||!drawn_path)&&B.parentNode.id!="selectorParentGroup"&& -B.id!="svgcanvas"&&B.id!="svgroot"){b.setMode("select");Pb([B],true)}}else if(G!=null){b.addedNew=true;t=0.2;var Q;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){Q=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{Q[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){Q&&Q.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Pb([G],true);Ia(new Na(G));K("changed",[G])},t* -1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Eb=l.getScreenCTM().inverse();var C=O(t.pageX,t.pageY,Eb);C={x:C.x,y:C.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)C.factor=2;else{if(t.wheelDelta<=-120)C.factor=0.5}else if(t.detail)if(t.detail>0)C.factor=0.5;else if(t.detail<0)C.factor=2;C.factor&&K("zoomed",C)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},gb=b.textActions=function(){function g(fa){var ka=F.value=== -"";$(F).focus();if(!arguments.length)if(ka)fa=0;else{if(F.selectionEnd!==F.selectionStart)return;fa=F.selectionEnd}var qa;qa=G[fa];ka||F.setSelectionRange(fa,fa);B=la("text_cursor");if(!B){B=document.createElementNS(c,"line");oa(B,{id:"text_cursor",stroke:"#333","stroke-width":1});B=la("selectorParentGroup").appendChild(B)}H||(H=setInterval(function(){var za=B.getAttribute("display")==="none";B.setAttribute("display",za?"inline":"none")},600));ka=E(qa.x,P.y);qa=E(qa.x,P.y+P.height);oa(B,{x1:ka.x, -y1:ka.y,x2:qa.x,y2:qa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(fa,ka,qa){if(fa===ka)g(ka);else{qa||F.setSelectionRange(fa,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}fa=G[fa];var za=G[ka];B.setAttribute("visibility","hidden");ka=E(fa.x,P.y);qa=E(fa.x+(za.x-fa.x),P.y);var jb=E(fa.x,P.y+P.height);fa=E(fa.x+(za.x- -fa.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+qa.x+","+qa.y+" "+fa.x+","+fa.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(fa,ka){var qa=e.createSVGPoint();qa.x=fa;qa.y=ka;if(G.length==1)return 0;qa=C.getCharNumAtPosition(qa);if(qa<0){qa=G.length-2;if(fa<=G[0].x)qa=0}else if(qa>=G.length-2)qa=G.length-2;var za=G[qa];fa>za.x+za.width/2&&qa++;return qa}function v(fa,ka,qa){var za=F.selectionStart;fa=k(fa,ka);h(Math.min(za,fa),Math.max(za,fa),!qa)}function s(fa,ka){var qa={x:fa,y:ka};qa.x/= -p;qa.y/=p;if(Q){var za=O(qa.x,qa.y,Q.inverse());qa.x=za.x;qa.y=za.y}return qa}function E(fa,ka){var qa={x:fa,y:ka};if(Q){var za=O(qa.x,qa.y,Q);qa.x=za.x;qa.y=za.y}qa.x*=p;qa.y*=p;return qa}function z(fa){h(0,C.textContent.length);$(this).unbind(fa)}function t(fa){if(wa&&C){var ka=O(fa.pageX,fa.pageY,Eb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var qa=C.textContent,za=qa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;qa=qa.substr(ka).match(/^[a-z0-9]+/i);h(za,(qa?qa[0].length:0)+ka);$(fa.target).click(z); -setTimeout(function(){$(fa.target).unbind("click",z)},300)}}var C,F,B,D,H,G=[],P,Q,W,ua,wa;return{select:function(fa,ka,qa){C=fa;gb.toEditMode(ka,qa)},start:function(fa){C=fa;gb.toEditMode()},mouseDown:function(fa,ka,qa,za){fa=s(qa,za);F.focus();g(k(fa.x,fa.y));W=qa;ua=za},mouseMove:function(fa,ka){var qa=s(fa,ka);v(qa.x,qa.y)},mouseUp:function(fa,ka,qa){var za=s(ka,qa);v(za.x,za.y,true);fa.target!==C&&kaW-2&&qaua-2&&gb.toSelectMode(true)},setCursor:g,toEditMode:function(fa,ka){wa= -false;Ma="textedit";Qa.requestSelector(C).showGrips(false);Qa.requestSelector(C);gb.init();$(C).css("cursor","text");if(arguments.length){var qa=s(fa,ka);g(k(qa.x,qa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(fa){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");B&&$(B).attr("visibility","hidden");$(C).css("cursor","move");if(fa){$a();$(C).css("cursor","move");K("selected",[C]);Fb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur(); -C=false},setInputElem:function(fa){F=fa},clear:function(){Ma=="textedit"&&gb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=J[0];Qa.requestSelector(C).showGrips(false)}var fa=C.textContent.length,ka=C.getAttribute("transform");P=svgedit.utilities.getBBox(C);Q=ka?ea(C):null;G=Array(fa);F.focus();$(C).unbind("dblclick",t).dblclick(t);if(!fa)var qa={x:P.x+P.width/2,width:0};for(ka=0;ka=0&&this.selected_pts.push(C)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,C,F){if(Ma==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;t=mouse_y/p;C=la("path_stretch_line"); -k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!C){C=document.createElementNS(c,"path");oa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=la("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var B=null;if(s){B=s.pathSegList;for(var D=B.numberOfItems,H=6/p,G=false;D;){D--;var P=B.getItem(D),Q=P.x;P=P.y;if(F>=Q-H&&F<=Q+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);Q=B.numberOfItems; -if(G){if(D<=1&&Q>=2){F=B.getItem(0).x;t=B.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();B.appendItem(z);B.appendItem(F)}else if(Q<3)return B=false;$(C).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&pb(H,{},svgedit.path.path.matrix.inverse());C=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(H).remove(); -svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(z))){console.log("Clicked outside canvas");return false}B=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(B-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(mb(F),mb(t)):s.createSVGPathSegCurvetoCubicAbs(mb(F),mb(t),z.x1/p,z.y1/ -p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;C.setAttribute("d",["M",F,t,F,t].join(" "));C=B;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});C.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id; -if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[C,F];B=svgedit.path.path.segs[t];if(z.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=H.split("_")[1].split("c");t=z[0]- -0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,C){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var B=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");B.setAttribute("cx",t);B.setAttribute("cy",C);B.setAttribute("display","inline");B=k[0];var H=k[1];F.getItem(z);var G= -B+(B-t/p),P=H+(H-C/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:C,x2:B*p,y2:H*p,display:"inline"});oa(Q,{x1:G*p,y1:P*p,x2:B*p,y2:H*p,display:"inline"});if(z===0)v=[t,C];else{F=F.getItem(z-1);t=F.x;C=F.y;if(F.pathSegType===6){t+=t-F.x2;C+=C-F.y2}else if(v){t=v[0]/p;C=v[1]/p}svgedit.path.replacePathSeg(6,z,[B,H,t,C,G,P],s)}}else if(B=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType=== -6)svgedit.path.replacePathSeg(6,1,[t,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,C],B);else v?svgedit.path.replacePathSeg(6,1,[t,C,v[0],v[1],t,C],B):svgedit.path.replacePathSeg(4,1,[t,C],B)}}}else if(svgedit.path.path.dragging){B=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);H=svgedit.path.getPointFromGrip({x:t,y:C},svgedit.path.path);z=H.x-B.x;B=H.y-B.y;svgedit.path.path.dragging=[t,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z, -B):svgedit.path.path.movePts(z,B)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging= -false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(C)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox= -svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Fb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"), -C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,C));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Fb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z== -null||z.nodeName!="path")return false;var t=V(z),C=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,B=0;B0){H=F.getItem(B-1).pathSegType;if(H===2){D(B-1,1);C();break}else if(H=== -1&&F.numberOfItems-1===B){D(B,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){z=$(svgedit.path.path.elem);z.attr("d",z.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(z){var t=z.points,C=t.numberOfItems;if(C>=4){var F=t.getItem(0),B=null;z=[];z.push(["M",F.x,",", -F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(B)if((F=svgedit.path.smoothControlPoints(B,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;B=G}for(z.push("L");D0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){Sb();Pb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s=0;C--){t=z.item(C); -D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(qb.apply&&g.nodeName==="image"&&t.localName==="href"&&qb.images&&qb.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D); -k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("