From a7447fbbe2c220a8946a461b1ac8656cfb84e2ba Mon Sep 17 00:00:00 2001 From: cuixiping Date: Sat, 21 Dec 2019 20:35:22 +0800 Subject: [PATCH] Fix: main menu style and text #371 --- editor/images/config.png | Bin 0 -> 549 bytes editor/images/config.svg | 1 + editor/images/svg_edit_icons.svg | 4 ++++ editor/locale/locale.js | 2 ++ editor/svg-editor-es.html | 24 ++++++++++------------ editor/svg-editor.css | 7 ++----- editor/svg-editor.js | 33 ++++++++++++++++++++++++------- 7 files changed, 45 insertions(+), 26 deletions(-) create mode 100644 editor/images/config.png create mode 100644 editor/images/config.svg diff --git a/editor/images/config.png b/editor/images/config.png new file mode 100644 index 0000000000000000000000000000000000000000..a4fbf6b5532454e99423bb92054686453cde46bb GIT binary patch literal 549 zcmV+=0^0qFP)s^>xn&;Oe^??(31KNM9i8d^?9D1&LRE*3knRQILzTyVa)}y@-uy#X#9O6~pt`CwN n_-nIk-f23#@k*^6hr0h4SnhtOx_`$J00000NkvXXu0mjfPG|xb literal 0 HcmV?d00001 diff --git a/editor/images/config.svg b/editor/images/config.svg new file mode 100644 index 00000000..a62cae6e --- /dev/null +++ b/editor/images/config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/editor/images/svg_edit_icons.svg b/editor/images/svg_edit_icons.svg index d2e36b9f..a4721624 100644 --- a/editor/images/svg_edit_icons.svg +++ b/editor/images/svg_edit_icons.svg @@ -1027,6 +1027,10 @@ + + + + diff --git a/editor/locale/locale.js b/editor/locale/locale.js index e3f29cfa..27d0ac1e 100644 --- a/editor/locale/locale.js +++ b/editor/locale/locale.js @@ -205,6 +205,8 @@ export const readLang = async function (langData) { tool_import: tools.import_doc, tool_open: tools.open_doc, tool_save: tools.save_doc, + tool_editor_prefs: config.editor_prefs, + tool_editor_homepage: tools.editor_homepage, svginfo_units_rulers: config.units_and_rulers, svginfo_rulers_onoff: config.show_rulers, diff --git a/editor/svg-editor-es.html b/editor/svg-editor-es.html index ee91b693..f6a09a2f 100644 --- a/editor/svg-editor-es.html +++ b/editor/svg-editor-es.html @@ -108,15 +108,11 @@ New Image (N)
  • @@ -131,15 +127,15 @@
    Document Properties (D)
  • +
  • +
    + Editor Preferences +
  • +
  • +
    + SVG-Edit Home Page +
  • -

    - - SVG-edit Home Page - -

    -
    diff --git a/editor/svg-editor.css b/editor/svg-editor.css index 7f866b8b..8df0b267 100644 --- a/editor/svg-editor.css +++ b/editor/svg-editor.css @@ -431,7 +431,7 @@ div.palette_item:first-child { padding-left: 7px; margin: -5px; overflow: auto; - cursor: default; + cursor: pointer; } #main_menu li:hover { @@ -1246,10 +1246,6 @@ ul li.current { margin-left: 0; } -#tool_prefs_option { - float: right; -} - .toolbar_button button { border:1px solid #dedede; line-height:130%; @@ -1264,6 +1260,7 @@ ul li.current { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; + cursor: pointer; } .toolbar_button button:hover { diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 7cb273bd..2c069c3c 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -57,6 +57,9 @@ if (!$.loadingStylesheets) { $.loadingStylesheets = []; } */ + +const homePage = 'https://github.com/SVG-Edit/svgedit'; + const stylesheet = 'svg-editor.css'; if (!$.loadingStylesheets.includes(stylesheet)) { $.loadingStylesheets.push(stylesheet); @@ -1276,7 +1279,8 @@ editor.init = function () { node_delete: 'node_delete.png', node_clone: 'node_clone.png', - globe_link: 'globe_link.png' + globe_link: 'globe_link.png', + config: 'config.png' }, placement: { '#logo': 'logo', @@ -1284,10 +1288,12 @@ editor.init = function () { '#tool_clear div,#layer_new': 'new_image', '#tool_save div': 'save', '#tool_export div': 'export', - '#tool_open div div': 'open', - '#tool_import div div': 'import', + '#tool_open div': 'open', + '#tool_import div': 'import', '#tool_source': 'source', '#tool_docprops > div': 'docprops', + '#tool_editor_prefs > div': 'config', + '#tool_editor_homepage > div': 'globe_link', '#tool_wireframe': 'wireframe', '#tool_undo': 'undo', @@ -4724,6 +4730,14 @@ editor.init = function () { $('#svg_prefs').show(); }; + /** + * + * @returns {void} + */ + const openHomePage = function () { + window.open(homePage, '_blank'); + }; + /** * * @returns {void} @@ -5608,9 +5622,12 @@ editor.init = function () { key: ['esc', false, false], hidekey: true}, {sel: '#tool_source_save', fn: saveSourceEditor, evt: 'click'}, {sel: '#tool_docprops_save', fn: saveDocProperties, evt: 'click'}, - {sel: '#tool_docprops', fn: showDocProperties, evt: 'mouseup'}, + {sel: '#tool_docprops', fn: showDocProperties, evt: 'click'}, {sel: '#tool_prefs_save', fn: savePreferences, evt: 'click'}, - {sel: '#tool_prefs_option', fn () { showPreferences(); return false; }, evt: 'mouseup'}, + {sel: '#tool_editor_prefs', fn: showPreferences, evt: 'click'}, + {sel: '#tool_editor_homepage', fn: openHomePage, evt: 'click'}, + {sel: '#tool_open', fn () { window.dispatchEvent(new CustomEvent('openImage')); }, evt: 'click'}, + {sel: '#tool_import', fn () { window.dispatchEvent(new CustomEvent('importImage')); }, evt: 'click'}, {sel: '#tool_delete,#tool_delete_multi', fn: deleteSelected, evt: 'click', key: ['del/backspace', true]}, {sel: '#tool_reorient', fn: reorientPath, evt: 'click'}, @@ -6209,10 +6226,12 @@ editor.init = function () { reader.readAsText(this.files[0]); } }); - $('#tool_open').show().prepend(open); + $('#tool_open').show(); + $(window).on('openImage', () => open.click()); const imgImport = $('').change(importImage); - $('#tool_import').show().prepend(imgImport); + $('#tool_import').show(); + $(window).on('importImage', () => imgImport.click()); } updateCanvas(true);