diff --git a/.gitignore b/.gitignore index e01f87c..ed646d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/* .DS_Store -deploy.sh \ No newline at end of file +deploy.sh +fuji.sh \ No newline at end of file diff --git a/dist/all.css b/dist/all.css old mode 100644 new mode 100755 index 0fe9a8e..e110724 --- a/dist/all.css +++ b/dist/all.css @@ -152,6 +152,7 @@ table#svg_editor .jPicker { } #svg_editor .jPicker .Button input { width: 100px; + cursor: pointer; } #svg_editor .jPicker td.Radio { @@ -162,6 +163,7 @@ table#svg_editor .jPicker { #svg_editor .jPicker td.Radio input { margin: 0 5px 0 0; padding: 0; + cursor: pointer; } #svg_editor .jPicker td.Text { font-size: 12px!important; @@ -182,7 +184,6 @@ table#svg_editor .jPicker { } #svg_editor .jPicker td.Text input { background-color: #fff; - border: 1px inset #aaa; height: 15px; margin: 0 0 0 5px; text-align: left; @@ -1892,6 +1893,7 @@ div#font-selector .font-item:hover { #color_picker input[type=text], #color_picker input[type=number] { width: 30px; background: #fff; + border: solid rgba(0,0,0,0.3) 1px; } .dropdown_set input[type=text], .dropdown_set input[type=number] { diff --git a/dist/all.js b/dist/all.js index d1f1d4d..939e3f3 100644 --- a/dist/all.js +++ b/dist/all.js @@ -960,12 +960,6 @@ $.jGraduate.Paint({hex: "#rrggbb", linearGradient: o}) -> throws an exception? (function() { var ns = { svg: 'http://www.w3.org/2000/svg', xlink: 'http://www.w3.org/1999/xlink' }; -if(!window.console) { - window.console = new function() { - this.log = function(str) {}; - this.dir = function(str) {}; - }; -} $.jGraduate = { Paint: @@ -1442,40 +1436,49 @@ jQuery.fn.jGraduate = 'stroke-width': 1.5 }, stopGroup); - $(path).mousedown(function(e) { + var $path = $(path); + + $path + .data('stop', stop) + .data('bg', pathbg) + .on("click", function(e) { + if (wasDragged) return wasDragged = false; // just dragged stop + $('div.jGraduate_LightBox').show(); + var colorhandle = this; + var stopOpacity = +stop.getAttribute('stop-opacity') || 1; + var stopColor = stop.getAttribute('stop-color') || 1; + var thisAlpha = (parseFloat(stopOpacity)*255).toString(16); + while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } + color = stopColor.substr(1) + thisAlpha; + $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'bottom': 15}).jPicker({ + window: { title: "Pick the start color and opacity for the gradient" }, + images: { clientPath: $settings.images.clientPath }, + color: { active: color, alphaSupport: true } + }, function(color, arg2){ + stopColor = color.val('hex') ? ('#'+color.val('hex')) : "none"; + stopOpacity = color.val('a') !== null ? color.val('a')/256 : 1; + colorhandle.setAttribute('fill', stopColor); + colorhandle.setAttribute('fill-opacity', stopOpacity); + stop.setAttribute('stop-color', stopColor); + stop.setAttribute('stop-opacity', stopOpacity); + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }, null, function() { + $('div.jGraduate_LightBox').hide(); + $('#'+id+'_jGraduate_stopPicker').hide(); + }); + }); + + $path.mousedown(function(e) { selectStop(this); drag = cur_stop; + wasDragged = false; $win.mousemove(dragColor).mouseup(remDrags); stop_offset = stopMakerDiv.offset(); e.preventDefault(); return false; - }).data('stop', stop).data('bg', pathbg).dblclick(function() { - $('div.jGraduate_LightBox').show(); - var colorhandle = this; - var stopOpacity = +stop.getAttribute('stop-opacity') || 1; - var stopColor = stop.getAttribute('stop-color') || 1; - var thisAlpha = (parseFloat(stopOpacity)*255).toString(16); - while (thisAlpha.length < 2) { thisAlpha = "0" + thisAlpha; } - color = stopColor.substr(1) + thisAlpha; - $('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'bottom': 15}).jPicker({ - window: { title: "Pick the start color and opacity for the gradient" }, - images: { clientPath: $settings.images.clientPath }, - color: { active: color, alphaSupport: true } - }, function(color, arg2){ - stopColor = color.val('hex') ? ('#'+color.val('hex')) : "none"; - stopOpacity = color.val('a') !== null ? color.val('a')/256 : 1; - colorhandle.setAttribute('fill', stopColor); - colorhandle.setAttribute('fill-opacity', stopOpacity); - stop.setAttribute('stop-color', stopColor); - stop.setAttribute('stop-opacity', stopOpacity); - $('div.jGraduate_LightBox').hide(); - $('#'+id+'_jGraduate_stopPicker').hide(); - }, null, function() { - $('div.jGraduate_LightBox').hide(); - $('#'+id+'_jGraduate_stopPicker').hide(); - }); }); - + $(curGradient).find('stop').each(function() { var cur_s = $(this); if(+this.getAttribute('offset') > n) { @@ -1505,6 +1508,8 @@ jQuery.fn.jGraduate = var stops, stopGroup; + + var wasDragged = false; var stopMakerDiv = $('#' + id + '_jGraduate_StopSlider'); @@ -1531,7 +1536,10 @@ jQuery.fn.jGraduate = var stop_offset; - function remDrags() { + function remDrags(e) { + if (!wasDragged) { + $(e.target).trigger("click"); // safari and windows fix, others no harm done + } $win.unbind('mousemove', dragColor); if(delStop.getAttribute('display') !== 'none') { remStop(); @@ -1557,7 +1565,7 @@ jQuery.fn.jGraduate = } function dragColor(evt) { - + wasDragged = true; var x = evt.pageX - stop_offset.left; var y = evt.pageY - stop_offset.top; x = x < 10 ? 10 : x > MAX + 10 ? MAX + 10: x; @@ -1970,6 +1978,7 @@ jQuery.fn.jGraduate = }); var dragSlider = function(evt) { + wasDragged = true; setSlider(evt); evt.preventDefault(); }; @@ -20840,7 +20849,7 @@ var svgedit = svgedit || {}; var all = color.active.val('all'); if (win.alphaPrecision < 0) win.alphaPrecision = 0; else if (win.alphaPrecision > 2) win.alphaPrecision = 2; - var controlHtml='' + (win.expandable ? '' : '') + '' : ' ') + '
 

' + (win.title || localization.text.title) + '

   
      
' + localization.text.newColor + '
  
' + localization.text.currentColor + '
 
 º
 %
 %

' + (win.alphaSupport ? '' : ' ') + '' + (win.alphaSupport ? ' %' : ' ') + '
' + (win.alphaSupport ? '
'; + var controlHtml='' + (win.expandable ? '' : '') + '' : ' ') + '
 

' + (win.title || localization.text.title) + '

   
      
' + localization.text.newColor + '
  
' + localization.text.currentColor + '
 
 º
 %
 %

' + (win.alphaSupport ? '' : ' ') + '' + (win.alphaSupport ? ' %' : ' ') + '
' + (win.alphaSupport ? '
'; if (win.expandable) { container.html(controlHtml); @@ -21216,7 +21225,7 @@ var svgedit = svgedit || {}; hue: { radio: 'Set To “Hue” Color Mode', - textbox: 'Enter A “Hue” Value (0-360°)' + textbox: 'Enter A “Hue” Value (0-360°)', }, saturation: { @@ -22436,4 +22445,18 @@ if (typeof module !== "undefined" && module.exports) { define([], function() { return saveAs; }); +} +// window.addEventListener('paste', ... or +document.onpaste = function(event){ + var items = (event.clipboardData || event.originalEvent.clipboardData).items; + for (index in items) { + var item = items[index]; + if (item.kind === 'file') { + var blob = item.getAsFile(); + var reader = new FileReader(); + reader.onload = function(event){ + console.log(event.target.result)}; // data url! + reader.readAsDataURL(blob); + } + } } \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index d749d03..896f265 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3,14 +3,14 @@ - + Method Draw SVG Editor - + @@ -644,7 +644,7 @@ - + diff --git a/package-lock.json b/package-lock.json index a6397c6..5df9ce4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1781,9 +1781,9 @@ "dev": true }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": { diff --git a/package.json b/package.json index f97b0f2..3c534fb 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "keywords": [ "SVG", "vector", - "editor" + "vector-editor" ], "author": "Mark MacKay", "license": "MIT",