From a68696ee349b3b0eb53628ca6fe8e1d097244ce7 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Wed, 25 Jul 2018 16:43:29 -0700 Subject: [PATCH] - Refactoring (minor): Array destructuring - Refactoring (minor): ES6 templates - i18n: picking stroke/fill paint and opacity --- editor/locale/lang.en.js | 4 +++- editor/svg-editor.js | 26 +++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/editor/locale/lang.en.js b/editor/locale/lang.en.js index ab080cb2..610b8ffe 100644 --- a/editor/locale/lang.en.js +++ b/editor/locale/lang.en.js @@ -23,7 +23,9 @@ export default { panel_drag: 'Drag left/right to resize side panel', quality: 'Quality:', pathNodeTooltip: 'Drag node to move it. Double-click node to change segment type', - pathCtrlPtTooltip: 'Drag control point to adjust curve properties' + pathCtrlPtTooltip: 'Drag control point to adjust curve properties', + pick_stroke_paint_opacity: 'Pick a Stroke Paint and Opacity', + pick_fill_paint_opacity: 'Pick a Fill Paint and Opacity' }, properties: { id: 'id', diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 30844c6b..62a4bba0 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -4074,12 +4074,12 @@ editor.init = function () { * @returns {undefined} */ const clickClear = function () { - const dims = curConfig.dimensions; + const [x, y] = curConfig.dimensions; $.confirm(uiStrings.notification.QwantToClear, function (ok) { if (!ok) { return; } setSelectMode(); svgCanvas.clear(); - svgCanvas.setResolution(dims[0], dims[1]); + svgCanvas.setResolution(x, y); updateCanvas(true); zoomImage(); populateLayers(); @@ -4133,7 +4133,13 @@ editor.init = function () { if (loadingURL) { popURL = loadingURL; } else { - popHTML = '' + str + '

' + str + '

'; + popHTML = ` + + + ${str} + +

${str}

+ `; if (typeof URL && URL.createObjectURL) { const blob = new Blob([popHTML], {type: 'text/html'}); popURL = URL.createObjectURL(blob); @@ -4534,7 +4540,9 @@ editor.init = function () { const colorPicker = function (elem) { const picker = elem.attr('id') === 'stroke_color' ? 'stroke' : 'fill'; // const opacity = (picker == 'stroke' ? $('#stroke_opacity') : $('#fill_opacity')); - const title = (picker === 'stroke' ? 'Pick a Stroke Paint and Opacity' : 'Pick a Fill Paint and Opacity'); + const title = picker === 'stroke' + ? uiStrings.ui.pick_stroke_paint_opacity + : uiStrings.ui.pick_fill_paint_opacity; // let wasNone = false; // Currently unused const pos = elem.offset(); let {paint} = paintBox[picker]; @@ -4568,9 +4576,13 @@ editor.init = function () { const cur = curConfig[type === 'fill' ? 'initFill' : 'initStroke']; // set up gradients to be used for the buttons const svgdocbox = new DOMParser().parseFromString( - '' + -' ', 'text/xml'); + ` + + + `, + 'text/xml' + ); let docElem = svgdocbox.documentElement; docElem = $(container)[0].appendChild(document.importNode(docElem, true));