From f5a19b8fe7840130e8d5a6acf9071f238c01de92 Mon Sep 17 00:00:00 2001 From: Alexis Deveria Date: Wed, 12 May 2010 15:45:43 +0000 Subject: [PATCH] Fixed some icon size related bugs git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1568 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svg-editor.css | 18 ++++++++++-------- editor/svg-editor.js | 29 ++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/editor/svg-editor.css b/editor/svg-editor.css index 47ffe861..0f9ac93f 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -79,15 +79,18 @@ } #svg_editor #color_tools .icon_label { - padding-right: 0; - height: 26px; - min-width: 18px; + padding: 3px 19%; + width: 28px; + height: 100%; cursor: pointer; + } -#group_opacityLabel, -#zoomLabel { +#svg_editor #group_opacityLabel, +#svg_editor #zoomLabel { cursor: pointer; + margin-right: 5px; + padding-top: 4px } #color_tools .icon_label > * { @@ -738,9 +741,9 @@ span.zoom_tool { .color_tool > * { display: table-cell; background: #f0f0f0; - padding: 0 5px; + padding: 0 5px 0 0; vertical-align: middle; - height: 25px; +/* height: 25px;*/ } #toggle_stroke_tools { @@ -841,7 +844,6 @@ span.zoom_tool { -moz-border-radius-bottomright: 4px; -webkit-border-top-right-radius: 4px; -webkit-border-bottom-right-radius: 4px; - } #svg_editor #tool_opacity { diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 85cdc757..a3aebe16 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -461,20 +461,18 @@ var togglePathEditMode = function(editmode, elems) { $('#path_node_panel').toggle(editmode); $('#tools_bottom_2,#tools_bottom_3').toggle(!editmode); - var size = $('#tool_select > svg, #tool_select > img')[0].getAttribute('width'); if(editmode) { // Change select icon $('.tool_button_current').removeClass('tool_button_current').addClass('tool_button'); - $('#tool_select').addClass('tool_button_current').removeClass('tool_button') - .empty().append($.getSvgIcon('select_node')); + $('#tool_select').addClass('tool_button_current').removeClass('tool_button'); + setIcon('#tool_select', 'select_node'); multiselected = false; if(elems.length) { selectedElement = elems[0]; } } else { - $('#tool_select').empty().append($.getSvgIcon('select')); + setIcon('#tool_select', 'select'); } - $.resizeSvgIcons({'#tool_select .svg_icon':size}); } // used to make the flyouts stay on the screen longer the very first time @@ -1162,9 +1160,7 @@ $('#tool_node_delete').toggleClass('disabled', !path.canDeleteNodes); // Show open/close button based on selected point - $('#tool_openclose_path') - .empty() - .append($.getSvgIcon(path.closed_subpath ? 'open_path' : 'close_path')); + setIcon('#tool_openclose_path', path.closed_subpath ? 'open_path' : 'close_path'); if(point) { var seg_type = $('#seg_type'); @@ -2295,6 +2291,17 @@ // This should be done in svgcanvas.js for the borderRect fill svgCanvas.setBackground(color, url); } + + var setIcon = function(elem, icon_id) { + var icon = $.getSvgIcon(icon_id).clone(); + $(elem).empty().append(icon); + var size = curPrefs.iconsize; + if(size !== 'm') { + var icon_sizes = { s:16, m:24, l:32, xl:48}, obj = {}; + obj[elem + ' .svg_icon'] = icon_sizes[size]; + $.resizeSvgIcons(obj); + } + } var setIconSize = Editor.setIconSize = function(size, force) { if(size == curPrefs.size && !force) return; @@ -2357,7 +2364,11 @@ 'height': {s: '58px', l: '98px', xl: '145px'} }, "#color_tools": { - 'border-spacing': {s: '0 1px'} + 'border-spacing': {s: '0 1px'}, + 'margin-top': {s: '-1px'} + }, + "#color_tools .icon_label": { + 'width': {l:'43px', xl: '60px'} }, ".color_tool": { 'height': {s: '20px'}