From a4c59f9eddd51b6eb90371692c71fa8ebe99ebc7 Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Sat, 14 Jul 2012 21:04:42 -0500 Subject: [PATCH] various fixes --- editor/select.js | 6 ++++-- editor/svg-editor.html | 4 +++- editor/svg-editor.js | 47 +++++++++++++++++++++++++++--------------- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/editor/select.js b/editor/select.js index cd3311c..f2dac42 100644 --- a/editor/select.js +++ b/editor/select.js @@ -331,9 +331,11 @@ svgedit.select.SelectorManager.prototype.initGroup = function() { 'element': 'circle', 'attr': { 'id': 'selectorGrip_rotate_' + dir, - 'fill': 'transparent', + 'fill': '#000', 'r': 8, - 'stroke': 'transparent', + 'stroke': '#000', + "fill-opacity": 0, + "stroke-opacity": 0, 'stroke-width': 0, 'style': 'cursor:url(' + config_.imgPath + 'rotate.png) 12 12, auto;' } diff --git a/editor/svg-editor.html b/editor/svg-editor.html index 90d10fb..8842c42 100644 --- a/editor/svg-editor.html +++ b/editor/svg-editor.html @@ -147,6 +147,7 @@ $(function(){
+ @@ -173,7 +174,8 @@ $(function(){ diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 20a1e8c..4628d43 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -2466,19 +2466,21 @@ var cutSelected = function() { if (selectedElement != null || multiselected) { + if (window.event.type === "keydown") flash($('#edit_menu')); svgCanvas.cutSelectedElements(); } }; var copySelected = function() { if (selectedElement != null || multiselected) { + if (window.event.type === "keydown") flash($('#edit_menu')); svgCanvas.copySelectedElements(); } }; - var pasteInCenter = function() { - var zoom = svgCanvas.getZoom(); - + var pasteSelected = function() { + if (window.event.type === "keydown") flash($('#edit_menu')); + var zoom = svgCanvas.getZoom(); var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW; var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH; svgCanvas.pasteElements('point', x, y); @@ -2486,30 +2488,35 @@ var moveToTopSelected = function() { if (selectedElement != null) { + if (window.event.type === "keydown") flash($('#object_menu')); svgCanvas.moveToTopSelectedElement(); } }; var moveToBottomSelected = function() { if (selectedElement != null) { + if (window.event.type === "keydown") flash($('#object_menu')); svgCanvas.moveToBottomSelectedElement(); } }; var moveUpSelected = function() { if (selectedElement != null) { + if (window.event.type === "keydown") flash($('#object_menu')); svgCanvas.moveUpDownSelected("Up"); } }; var moveDownSelected = function() { if (selectedElement != null) { + if (window.event.type === "keydown") flash($('#object_menu')); svgCanvas.moveUpDownSelected("Down"); } }; var moveUpDownSelected = function(dir) { if (selectedElement != null) { + if (window.event.type === "keydown") flash($('#object_menu')); svgCanvas.moveUpDownSelected(dir); } }; @@ -2548,6 +2555,7 @@ dx *= multi; dy *= multi; } + $('input').blur() svgCanvas.moveSelectedElements(dx,dy); } }; @@ -2765,6 +2773,11 @@ updateWireFrame(); } + var clickCanvasColor = function(){ + svgCanvas.clearSelection(); + $('#tool_canvas').trigger("click") + }; + var minimizeModal = function() { if (window.self != window.top) { //we're in an iframe @@ -3513,10 +3526,12 @@ if (type == "fill") cur = curConfig['initFill']; if (type == "canvas" && background) { var rgb = background.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); - var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + - ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + - ("0" + parseInt(rgb[3],10).toString(16)).slice(-2); - cur = {color: hex, opacity: 1} + if (rgb) { + var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + + ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + + ("0" + parseInt(rgb[3],10).toString(16)).slice(-2); + cur = {color: hex, opacity: 1} + } } @@ -4111,14 +4126,19 @@ {sel:'#tool_move_down', fn: moveDownSelected, evt:'click', key: [modKey+'down', true]}, {sel:'#tool_topath', fn: convertToPath, evt: 'click'}, {sel:'#tool_make_link,#tool_make_link_multi', fn: makeHyperlink, evt: 'click'}, - {sel:'#tool_undo', fn: clickUndo, evt: 'click'}, - {sel:'#tool_redo', fn: clickRedo, evt: 'click', key: ['Y', true]}, {sel:'#tool_clone,#tool_clone_multi', fn: clickClone, evt: 'click', key: [modKey + 'D', true]}, {sel:'#tool_group', fn: clickGroup, evt: 'click', key: [modKey + 'G', true]}, {sel:'#tool_ungroup', fn: clickGroup, evt: 'click', key: modKey + 'shift+G'}, {sel:'#tool_unlink_use', fn: clickGroup, evt: 'click'}, {sel:'[id^=tool_align]', fn: clickAlign, evt: 'click'}, - {sel:'#tool_switch', fn: clickSwitch, evt: 'click', key: ['X', true]}, + {sel:'#tool_switch', fn: clickSwitch, evt: 'click', key: ['shift+x', true]}, + {sel:'#tool_undo', fn: clickUndo, evt: 'click', key: modKey + 'z'}, + {sel:'#tool_redo', fn: clickRedo, evt: 'click', key: ['y', true]}, + {sel:'#tool_canvas_color_menu', fn: clickCanvasColor, evt: 'click'}, + {sel:'#tool_cut', fn: cutSelected, evt: 'click', key: modKey+'x'}, + {sel:'#tool_copy', fn: copySelected, evt: 'click', key: modKey+'c'}, + {sel:'#tool_paste', fn: pasteSelected, evt: 'click', key: modKey+'v'}, + // these two lines are required to make Opera work properly with the flyout mechanism // {sel:'#tools_rect_show', fn: clickRect, evt: 'click'}, // {sel:'#tools_ellipse_show', fn: clickEllipse, evt: 'click'}, @@ -4156,15 +4176,8 @@ {key: modKey + 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}}, // Standard shortcuts - {key: modKey + 'z', fn: clickUndo}, {key: modKey + 'shift+z', fn: clickRedo}, - {key: modKey + 'y', fn: clickRedo}, {key: 'esc', fn: minimizeModal}, - {key: modKey+'x', fn: cutSelected}, - {key: modKey+'c', fn: copySelected}, - {key: modKey+'v', fn: pasteInCenter} - - ]; // Tooltips not directly associated with a single function