Add shortcut key (X) to eXpand/collapse the side panel

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@822 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-10-14 04:16:48 +00:00
parent 923aa6abb6
commit 2b6d0c467b
3 changed files with 18 additions and 3 deletions

View File

@ -116,5 +116,5 @@
{"id":"tool_node_delete","title":"Delete Node"},
{"id":"selLayerLabel","textContent":"Move elements to:"},
{"id":"selLayerNames","title":"Move selected elements to a different layer"},
{"id":"sidepanel_handle","title":"Drag left/right to resize side panel","textContent":"L a y e r s"}
{"id":"sidepanel_handle","title":"Drag left/right to resize side panel [X]","textContent":"L a y e r s"}
];

View File

@ -71,7 +71,7 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
<option selected="selected" value="layer1">Layer 1</option>
</select>
</div>
<div id="sidepanel_handle" onselectstart="return false;" title="Drag left/right to resize side panel">L a y e r s</div>
<div id="sidepanel_handle" onselectstart="return false;" title="Drag left/right to resize side panel [X]">L a y e r s</div>
</div>
<div id="logo">

View File

@ -999,6 +999,7 @@ function svg_edit_setup() {
[modKey+'i', function(evt){showDocProperties();evt.preventDefault();}],
[modKey+'c', function(evt){clickClone();evt.preventDefault();}],
[modKey+'g', function(evt){clickGroup();evt.preventDefault();}],
[modKey+'x', function(evt){toggleSidePanel();}],
['esc', cancelOverlays, false],
];
@ -1265,16 +1266,30 @@ function svg_edit_setup() {
if (deltax == 0) return;
sidedrag = evt.pageX;
var sidewidth = parseInt($('#sidepanels').css('width'))+deltax;
if (sidewidth <= 130 && sidewidth >= 1) {
if (sidewidth <= 130 && sidewidth >= 2) {
var workarea = $('#workarea');
var sidepanels = $('#sidepanels');
var layerpanel = $('#layerpanel');
workarea.css('right', parseInt(workarea.css('right'))+deltax);
sidepanels.css('width', parseInt(sidepanels.css('width'))+deltax);
layerpanel.css('width', parseInt(layerpanel.css('width'))+deltax);
centerCanvasIfNeeded();
}
});
// if width is non-zero, then fully close it, otherwise fully open it
var toggleSidePanel = function(){
var w = parseInt($('#sidepanels').css('width'));
var deltax = (w > 2 ? 2 : 130) - w;
var workarea = $('#workarea');
var sidepanels = $('#sidepanels');
var layerpanel = $('#layerpanel');
workarea.css('right', parseInt(workarea.css('right'))+deltax);
sidepanels.css('width', parseInt(sidepanels.css('width'))+deltax);
layerpanel.css('width', parseInt(layerpanel.css('width'))+deltax);
centerCanvasIfNeeded();
};
var populateLayers = function(){
var layerlist = $('#layerlist tbody');
var selLayerNames = $('#selLayerNames');