various fixes

master
Mark MacKay 2012-07-14 21:04:42 -05:00
parent d7f4e73f71
commit a4c59f9edd
3 changed files with 37 additions and 20 deletions

View File

@ -331,9 +331,11 @@ svgedit.select.SelectorManager.prototype.initGroup = function() {
'element': 'circle', 'element': 'circle',
'attr': { 'attr': {
'id': 'selectorGrip_rotate_' + dir, 'id': 'selectorGrip_rotate_' + dir,
'fill': 'transparent', 'fill': '#000',
'r': 8, 'r': 8,
'stroke': 'transparent', 'stroke': '#000',
"fill-opacity": 0,
"stroke-opacity": 0,
'stroke-width': 0, 'stroke-width': 0,
'style': 'cursor:url(' + config_.imgPath + 'rotate.png) 12 12, auto;' 'style': 'cursor:url(' + config_.imgPath + 'rotate.png) 12 12, auto;'
} }

View File

@ -147,6 +147,7 @@ $(function(){
<div class="menu_item" id="tool_undo">Undo <span class="shortcut">⌘Z</span></div> <div class="menu_item" id="tool_undo">Undo <span class="shortcut">⌘Z</span></div>
<div class="menu_item" id="tool_redo">Redo <span class="shortcut">⌘Y</span></div> <div class="menu_item" id="tool_redo">Redo <span class="shortcut">⌘Y</span></div>
<div class="separator"></div> <div class="separator"></div>
<div class="menu_item action_selected disabled" id="tool_copy">Cut <span class="shortcut">⌘X</span></div>
<div class="menu_item action_selected disabled" id="tool_copy">Copy <span class="shortcut">⌘C</span></div> <div class="menu_item action_selected disabled" id="tool_copy">Copy <span class="shortcut">⌘C</span></div>
<div class="menu_item action_selected disabled" id="tool_paste">Paste <span class="shortcut">⌘V</span></div> <div class="menu_item action_selected disabled" id="tool_paste">Paste <span class="shortcut">⌘V</span></div>
<div class="menu_item action_selected disabled" id="tool_clone">Duplicate <span class="shortcut">⌘D</span></div> <div class="menu_item action_selected disabled" id="tool_clone">Duplicate <span class="shortcut">⌘D</span></div>
@ -173,7 +174,8 @@ $(function(){
<div class="menu"> <div class="menu">
<div class="menu_title">Canvas</div> <div class="menu_title">Canvas</div>
<div class="menu_list" id="canvas_menu"> <div class="menu_list" id="canvas_menu">
<div class="menu_item" id="tool_docprops">Canvas Properties...</div> <div class="menu_item" id="tool_docprops">Canvas Dimensions...</div>
<div class="menu_item" id="tool_canvas_color_menu">Canvas Color...</div>
</div> </div>
</div> </div>

View File

@ -2466,19 +2466,21 @@
var cutSelected = function() { var cutSelected = function() {
if (selectedElement != null || multiselected) { if (selectedElement != null || multiselected) {
if (window.event.type === "keydown") flash($('#edit_menu'));
svgCanvas.cutSelectedElements(); svgCanvas.cutSelectedElements();
} }
}; };
var copySelected = function() { var copySelected = function() {
if (selectedElement != null || multiselected) { if (selectedElement != null || multiselected) {
if (window.event.type === "keydown") flash($('#edit_menu'));
svgCanvas.copySelectedElements(); svgCanvas.copySelectedElements();
} }
}; };
var pasteInCenter = function() { var pasteSelected = function() {
if (window.event.type === "keydown") flash($('#edit_menu'));
var zoom = svgCanvas.getZoom(); var zoom = svgCanvas.getZoom();
var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW; var x = (workarea[0].scrollLeft + workarea.width()/2)/zoom - svgCanvas.contentW;
var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH; var y = (workarea[0].scrollTop + workarea.height()/2)/zoom - svgCanvas.contentH;
svgCanvas.pasteElements('point', x, y); svgCanvas.pasteElements('point', x, y);
@ -2486,30 +2488,35 @@
var moveToTopSelected = function() { var moveToTopSelected = function() {
if (selectedElement != null) { if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveToTopSelectedElement(); svgCanvas.moveToTopSelectedElement();
} }
}; };
var moveToBottomSelected = function() { var moveToBottomSelected = function() {
if (selectedElement != null) { if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveToBottomSelectedElement(); svgCanvas.moveToBottomSelectedElement();
} }
}; };
var moveUpSelected = function() { var moveUpSelected = function() {
if (selectedElement != null) { if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Up"); svgCanvas.moveUpDownSelected("Up");
} }
}; };
var moveDownSelected = function() { var moveDownSelected = function() {
if (selectedElement != null) { if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected("Down"); svgCanvas.moveUpDownSelected("Down");
} }
}; };
var moveUpDownSelected = function(dir) { var moveUpDownSelected = function(dir) {
if (selectedElement != null) { if (selectedElement != null) {
if (window.event.type === "keydown") flash($('#object_menu'));
svgCanvas.moveUpDownSelected(dir); svgCanvas.moveUpDownSelected(dir);
} }
}; };
@ -2548,6 +2555,7 @@
dx *= multi; dx *= multi;
dy *= multi; dy *= multi;
} }
$('input').blur()
svgCanvas.moveSelectedElements(dx,dy); svgCanvas.moveSelectedElements(dx,dy);
} }
}; };
@ -2765,6 +2773,11 @@
updateWireFrame(); updateWireFrame();
} }
var clickCanvasColor = function(){
svgCanvas.clearSelection();
$('#tool_canvas').trigger("click")
};
var minimizeModal = function() { var minimizeModal = function() {
if (window.self != window.top) { //we're in an iframe if (window.self != window.top) { //we're in an iframe
@ -3513,10 +3526,12 @@
if (type == "fill") cur = curConfig['initFill']; if (type == "fill") cur = curConfig['initFill'];
if (type == "canvas" && background) { if (type == "canvas" && background) {
var rgb = background.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); var rgb = background.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + if (rgb) {
("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + var hex = ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) +
("0" + parseInt(rgb[3],10).toString(16)).slice(-2); ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) +
cur = {color: hex, opacity: 1} ("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_move_down', fn: moveDownSelected, evt:'click', key: [modKey+'down', true]},
{sel:'#tool_topath', fn: convertToPath, evt: 'click'}, {sel:'#tool_topath', fn: convertToPath, evt: 'click'},
{sel:'#tool_make_link,#tool_make_link_multi', fn: makeHyperlink, 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_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_group', fn: clickGroup, evt: 'click', key: [modKey + 'G', true]},
{sel:'#tool_ungroup', fn: clickGroup, evt: 'click', key: modKey + 'shift+G'}, {sel:'#tool_ungroup', fn: clickGroup, evt: 'click', key: modKey + 'shift+G'},
{sel:'#tool_unlink_use', fn: clickGroup, evt: 'click'}, {sel:'#tool_unlink_use', fn: clickGroup, evt: 'click'},
{sel:'[id^=tool_align]', fn: clickAlign, 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 // these two lines are required to make Opera work properly with the flyout mechanism
// {sel:'#tools_rect_show', fn: clickRect, evt: 'click'}, // {sel:'#tools_rect_show', fn: clickRect, evt: 'click'},
// {sel:'#tools_ellipse_show', fn: clickEllipse, evt: 'click'}, // {sel:'#tools_ellipse_show', fn: clickEllipse, evt: 'click'},
@ -4156,15 +4176,8 @@
{key: modKey + 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}}, {key: modKey + 'A', fn: function(){svgCanvas.selectAllInCurrentLayer();}},
// Standard shortcuts // Standard shortcuts
{key: modKey + 'z', fn: clickUndo},
{key: modKey + 'shift+z', fn: clickRedo}, {key: modKey + 'shift+z', fn: clickRedo},
{key: modKey + 'y', fn: clickRedo},
{key: 'esc', fn: minimizeModal}, {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 // Tooltips not directly associated with a single function