- Fix: Delay icon setting until locales available (fixes #323)

master
Brett Zamir 2019-03-05 22:55:02 +08:00
parent d7a4c01c04
commit bc2e1ef725
10 changed files with 1397 additions and 1343 deletions

View File

@ -2,6 +2,7 @@
## ? ## ?
- Fix: Delay icon setting until locales available (fixes #323)
- Fix: Extension with no `placement` to be added to end; - Fix: Extension with no `placement` to be added to end;
for #326 (@sjernigan) for #326 (@sjernigan)
- Optimization fix: Properly run code conditionally on browser check; - Optimization fix: Properly run code conditionally on browser check;

561
dist/index-es.js vendored
View File

@ -29420,8 +29420,10 @@ editor.init = function () {
ok: ok, ok: ok,
cancel: cancel cancel: cancel
}); });
_context3.prev = 9; setIcons(); // Wait for dbox as needed for i18n
_context3.next = 12;
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
@ -29495,7 +29497,7 @@ editor.init = function () {
}; };
}())); }()));
case 12: case 13:
svgCanvas.bind('extensions_added', svgCanvas.bind('extensions_added',
/** /**
* @param {external:Window} win * @param {external:Window} win
@ -29525,21 +29527,21 @@ editor.init = function () {
}); });
}); });
svgCanvas.call('extensions_added'); svgCanvas.call('extensions_added');
_context3.next = 19; _context3.next = 20;
break; break;
case 16: case 17:
_context3.prev = 16; _context3.prev = 17;
_context3.t0 = _context3["catch"](9); _context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI // Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console console.log(_context3.t0); // eslint-disable-line no-console
case 19: case 20:
case "end": case "end":
return _context3.stop(); return _context3.stop();
} }
} }
}, _callee3, this, [[9, 16]]); }, _callee3, this, [[10, 17]]);
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
@ -29846,300 +29848,307 @@ editor.init = function () {
setFlyoutPositions(); setFlyoutPositions();
}; };
/**
* Setup SVG icons
*/
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
id_match: false,
no_img: !isWebkit(),
// Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
return regeneratorRuntime.wrap(function _callee4$(_context4) { function setIcons() {
while (1) { $$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
switch (_context4.prev = _context4.next) { w: 24,
case 0: h: 24,
getStylesheetPriority = function _ref8(stylesheetFile) { id_match: false,
switch (stylesheetFile) { no_img: !isWebkit(),
case 'jgraduate/css/jPicker.css': // Opera & Firefox 4 gives odd behavior w/images
return 1; fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
case 'jgraduate/css/jGraduate.css': return regeneratorRuntime.wrap(function _callee4$(_context4) {
return 2; while (1) {
switch (_context4.prev = _context4.next) {
case 0:
getStylesheetPriority = function _ref8(stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
case 'svg-editor.css': case 'jgraduate/css/jGraduate.css':
return 3; return 2;
case 'spinbtn/jQuery.SpinButton.css': case 'svg-editor.css':
return 4; return 3;
default: case 'spinbtn/jQuery.SpinButton.css':
return Infinity; return 4;
}
};
$$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () { default:
$$b(this).parent().prepend(this); return Infinity;
});
tleft = $$b('#tools_left');
if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
size = $$b.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () {
var shower = $$b('#' + this.id + '_show');
var sel = shower.attr('data-curopt'); // Check if there's an icon here
if (!shower.children('svg, img').length) {
var clone = $$b(sel).children().clone();
if (clone.length) {
clone[0].removeAttribute('style'); // Needed for Opera
shower.append(clone);
} }
} };
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) { $$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
var priorityA = getStylesheetPriority(a); $$b(this).parent().prepend(this);
var priorityB = getStylesheetPriority(b); });
tleft = $$b('#tools_left');
if (priorityA === priorityB) { if (tleft.length) {
return 0; minHeight = tleft.offset().top + tleft.outerHeight();
} }
return priorityA > priorityB; size = $$b.pref('iconsize');
}); editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
if (curConfig.stylesheets.length) { $$b('.tools_flyout').each(function () {
// Ensure a copy with unique items var shower = $$b('#' + this.id + '_show');
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets)); var sel = shower.attr('data-curopt'); // Check if there's an icon here
idx = stylesheets.indexOf('@default');
if (idx > -1) { if (!shower.children('svg, img').length) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets))); var clone = $$b(sel).children().clone();
}
}
_context4.next = 11; if (clone.length) {
return loadStylesheets(stylesheets, { clone[0].removeAttribute('style'); // Needed for Opera
acceptErrors: function acceptErrors(_ref7) {
var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { shower.append(clone);
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); }
return; }
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) {
var priorityA = getStylesheetPriority(a);
var priorityB = getStylesheetPriority(b);
if (priorityA === priorityB) {
return 0;
} }
resolve(); return priorityA > priorityB;
});
if (curConfig.stylesheets.length) {
// Ensure a copy with unique items
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets));
idx = stylesheets.indexOf('@default');
if (idx > -1) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets)));
}
} }
});
case 11: _context4.next = 11;
$$b('#svg_container')[0].style.visibility = 'visible'; return loadStylesheets(stylesheets, {
_context4.next = 14; acceptErrors: function acceptErrors(_ref7) {
return editor.runCallbacks(); var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
case 14: if ($$b.loadingStylesheets.includes(stylesheetURL)) {
case "end": reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
return _context4.stop(); return;
}
resolve();
}
});
case 11:
$$b('#svg_container')[0].style.visibility = 'visible';
_context4.next = 14;
return editor.runCallbacks();
case 14:
case "end":
return _context4.stop();
}
} }
} }, _callee4, this);
}, _callee4, this); }));
}));
function callback(_x3) { function callback(_x3) {
return _callback.apply(this, arguments); return _callback.apply(this, arguments);
} }
return callback; return callback;
}() }()
}); });
}
/** /**
* @name module:SVGEditor.canvas * @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}
*/ */
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig); editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item? var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'], '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36145,7 +36154,9 @@ editor.init = function () {
if (document.location.protocol === 'file:') { if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100); setTimeout(extAndLocaleFunc, 100);
} else { } else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this) // Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc(); extAndLocaleFunc();
} }
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

561
dist/index-umd.js vendored
View File

@ -29426,8 +29426,10 @@
ok: ok, ok: ok,
cancel: cancel cancel: cancel
}); });
_context3.prev = 9; setIcons(); // Wait for dbox as needed for i18n
_context3.next = 12;
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
@ -29501,7 +29503,7 @@
}; };
}())); }()));
case 12: case 13:
svgCanvas.bind('extensions_added', svgCanvas.bind('extensions_added',
/** /**
* @param {external:Window} win * @param {external:Window} win
@ -29531,21 +29533,21 @@
}); });
}); });
svgCanvas.call('extensions_added'); svgCanvas.call('extensions_added');
_context3.next = 19; _context3.next = 20;
break; break;
case 16: case 17:
_context3.prev = 16; _context3.prev = 17;
_context3.t0 = _context3["catch"](9); _context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI // Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console console.log(_context3.t0); // eslint-disable-line no-console
case 19: case 20:
case "end": case "end":
return _context3.stop(); return _context3.stop();
} }
} }
}, _callee3, this, [[9, 16]]); }, _callee3, this, [[10, 17]]);
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
@ -29852,300 +29854,307 @@
setFlyoutPositions(); setFlyoutPositions();
}; };
/**
* Setup SVG icons
*/
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
id_match: false,
no_img: !isWebkit(),
// Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
return regeneratorRuntime.wrap(function _callee4$(_context4) { function setIcons() {
while (1) { $$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
switch (_context4.prev = _context4.next) { w: 24,
case 0: h: 24,
getStylesheetPriority = function _ref8(stylesheetFile) { id_match: false,
switch (stylesheetFile) { no_img: !isWebkit(),
case 'jgraduate/css/jPicker.css': // Opera & Firefox 4 gives odd behavior w/images
return 1; fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
case 'jgraduate/css/jGraduate.css': return regeneratorRuntime.wrap(function _callee4$(_context4) {
return 2; while (1) {
switch (_context4.prev = _context4.next) {
case 0:
getStylesheetPriority = function _ref8(stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
case 'svg-editor.css': case 'jgraduate/css/jGraduate.css':
return 3; return 2;
case 'spinbtn/jQuery.SpinButton.css': case 'svg-editor.css':
return 4; return 3;
default: case 'spinbtn/jQuery.SpinButton.css':
return Infinity; return 4;
}
};
$$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () { default:
$$b(this).parent().prepend(this); return Infinity;
});
tleft = $$b('#tools_left');
if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
size = $$b.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () {
var shower = $$b('#' + this.id + '_show');
var sel = shower.attr('data-curopt'); // Check if there's an icon here
if (!shower.children('svg, img').length) {
var clone = $$b(sel).children().clone();
if (clone.length) {
clone[0].removeAttribute('style'); // Needed for Opera
shower.append(clone);
} }
} };
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) { $$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
var priorityA = getStylesheetPriority(a); $$b(this).parent().prepend(this);
var priorityB = getStylesheetPriority(b); });
tleft = $$b('#tools_left');
if (priorityA === priorityB) { if (tleft.length) {
return 0; minHeight = tleft.offset().top + tleft.outerHeight();
} }
return priorityA > priorityB; size = $$b.pref('iconsize');
}); editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
if (curConfig.stylesheets.length) { $$b('.tools_flyout').each(function () {
// Ensure a copy with unique items var shower = $$b('#' + this.id + '_show');
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets)); var sel = shower.attr('data-curopt'); // Check if there's an icon here
idx = stylesheets.indexOf('@default');
if (idx > -1) { if (!shower.children('svg, img').length) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets))); var clone = $$b(sel).children().clone();
}
}
_context4.next = 11; if (clone.length) {
return loadStylesheets(stylesheets, { clone[0].removeAttribute('style'); // Needed for Opera
acceptErrors: function acceptErrors(_ref7) {
var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { shower.append(clone);
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); }
return; }
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) {
var priorityA = getStylesheetPriority(a);
var priorityB = getStylesheetPriority(b);
if (priorityA === priorityB) {
return 0;
} }
resolve(); return priorityA > priorityB;
});
if (curConfig.stylesheets.length) {
// Ensure a copy with unique items
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets));
idx = stylesheets.indexOf('@default');
if (idx > -1) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets)));
}
} }
});
case 11: _context4.next = 11;
$$b('#svg_container')[0].style.visibility = 'visible'; return loadStylesheets(stylesheets, {
_context4.next = 14; acceptErrors: function acceptErrors(_ref7) {
return editor.runCallbacks(); var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
case 14: if ($$b.loadingStylesheets.includes(stylesheetURL)) {
case "end": reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
return _context4.stop(); return;
}
resolve();
}
});
case 11:
$$b('#svg_container')[0].style.visibility = 'visible';
_context4.next = 14;
return editor.runCallbacks();
case 14:
case "end":
return _context4.stop();
}
} }
} }, _callee4, this);
}, _callee4, this); }));
}));
function callback(_x3) { function callback(_x3) {
return _callback.apply(this, arguments); return _callback.apply(this, arguments);
} }
return callback; return callback;
}() }()
}); });
}
/** /**
* @name module:SVGEditor.canvas * @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}
*/ */
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig); editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item? var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'], '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36151,7 +36160,9 @@
if (document.location.protocol === 'file:') { if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100); setTimeout(extAndLocaleFunc, 100);
} else { } else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this) // Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc(); extAndLocaleFunc();
} }
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -808,6 +808,8 @@ editor.init = function () {
const {ok, cancel} = uiStrings.common; const {ok, cancel} = uiStrings.common;
jQueryPluginDBox($, {ok, cancel}); jQueryPluginDBox($, {ok, cancel});
setIcons(); // Wait for dbox as needed for i18n
try { try {
await Promise.all( await Promise.all(
curConfig.extensions.map(async (extname) => { curConfig.extensions.map(async (extname) => {
@ -1163,277 +1165,282 @@ editor.init = function () {
setFlyoutPositions(); setFlyoutPositions();
}; };
$.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24, h: 24,
id_match: false,
no_img: !isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png', /**
select_node: 'select_node.png', * Setup SVG icons
*/
function setIcons () {
$.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24, h: 24,
id_match: false,
no_img: !isWebkit(), // Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
square: 'square.png', select: 'select.png',
rect: 'rect.png', select_node: 'select_node.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png', square: 'square.png',
zoom: 'zoom.png', rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
arrow_right: 'flyouth.png', image: 'image.png',
arrow_right_big: 'arrow_right_big.png', zoom: 'zoom.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png', arrow_right: 'flyouth.png',
save: 'save.png', arrow_right_big: 'arrow_right_big.png',
export: 'export.png', arrow_down: 'dropdown.gif',
open: 'open.png', fill: 'fill.png',
import: 'import.png', stroke: 'stroke.png',
docprops: 'document-properties.png', opacity: 'opacity.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png', new_image: 'clear.png',
redo: 'redo.png', save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
clone: 'clone.png', undo: 'undo.png',
delete: 'delete.png', redo: 'redo.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png', clone: 'clone.png',
unlink_use: 'unlink_use.png', delete: 'delete.png',
width: 'width.png', go_up: 'go-up.png',
height: 'height.png', go_down: 'go-down.png',
c_radius: 'c_radius.png', context_menu: 'context_menu.png',
angle: 'angle.png', move_bottom: 'move_bottom.png',
blur: 'blur.png', move_top: 'move_top.png',
fontsize: 'fontsize.png', to_path: 'to_path.png',
align: 'align.png', link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
align_left: 'align-left.png', ungroup: 'shape_ungroup.png',
align_center: 'align-center.png', unlink_use: 'unlink_use.png',
align_right: 'align-right.png', width: 'width.png',
align_top: 'align-top.png', height: 'height.png',
align_middle: 'align-middle.png', c_radius: 'c_radius.png',
align_bottom: 'align-bottom.png', angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
linecap_butt: 'linecap_butt.png', align_left: 'align-left.png',
linecap_square: 'linecap_square.png', align_center: 'align-center.png',
linecap_round: 'linecap_round.png', align_right: 'align-right.png',
linejoin_miter: 'linejoin_miter.png', align_top: 'align-top.png',
linejoin_bevel: 'linejoin_bevel.png', align_middle: 'align-middle.png',
linejoin_round: 'linejoin_round.png', align_bottom: 'align-bottom.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png', linecap_butt: 'linecap_butt.png',
cancel: 'cancel.png', linecap_square: 'linecap_square.png',
warning: 'warning.png', linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
node_delete: 'node_delete.png', ok: 'save.png',
node_clone: 'node_clone.png', cancel: 'cancel.png',
warning: 'warning.png',
globe_link: 'globe_link.png' node_delete: 'node_delete.png',
}, node_clone: 'node_clone.png',
placement: {
'#logo': 'logo',
'#tool_clear div,#layer_new': 'new_image', globe_link: 'globe_link.png'
'#tool_save div': 'save', },
'#tool_export div': 'export', placement: {
'#tool_open div div': 'open', '#logo': 'logo',
'#tool_import div div': 'import',
'#tool_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo', '#tool_clear div,#layer_new': 'new_image',
'#tool_redo': 'redo', '#tool_save div': 'save',
'#tool_export div': 'export',
'#tool_open div div': 'open',
'#tool_import div div': 'import',
'#tool_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_select': 'select', '#tool_undo': 'undo',
'#tool_fhpath': 'pencil', '#tool_redo': 'redo',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone', '#tool_select': 'select',
'#tool_node_clone': 'node_clone', '#tool_fhpath': 'pencil',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete', '#tool_line': 'pen',
'#tool_node_delete': 'node_delete', '#tool_rect,#tools_rect_show': 'rect',
'#tool_add_subpath': 'add_subpath', '#tool_square': 'square',
'#tool_openclose_path': 'open_path', '#tool_fhrect': 'fh_rect',
'#tool_move_top': 'move_top', '#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_move_bottom': 'move_bottom', '#tool_circle': 'circle',
'#tool_topath': 'to_path', '#tool_fhellipse': 'fh_ellipse',
'#tool_node_link': 'link_controls', '#tool_path': 'path',
'#tool_reorient': 'reorient', '#tool_text,#layer_rename': 'text',
'#tool_group_elements': 'group_elements', '#tool_image': 'image',
'#tool_ungroup': 'ungroup', '#tool_zoom': 'zoom',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left', '#tool_clone,#tool_clone_multi': 'clone',
'#tool_aligncenter, #tool_poscenter': 'align_center', '#tool_node_clone': 'node_clone',
'#tool_alignright, #tool_posright': 'align_right', '#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_aligntop, #tool_postop': 'align_top', '#tool_node_delete': 'node_delete',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle', '#tool_add_subpath': 'add_subpath',
'#tool_alignbottom, #tool_posbottom': 'align_bottom', '#tool_openclose_path': 'open_path',
'#cur_position': 'align', '#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#linecap_butt,#cur_linecap': 'linecap_butt', '#tool_alignleft, #tool_posleft': 'align_left',
'#linecap_round': 'linecap_round', '#tool_aligncenter, #tool_poscenter': 'align_center',
'#linecap_square': 'linecap_square', '#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter', '#linecap_butt,#cur_linecap': 'linecap_butt',
'#linejoin_round': 'linejoin_round', '#linecap_round': 'linecap_round',
'#linejoin_bevel': 'linejoin_bevel', '#linecap_square': 'linecap_square',
'#url_notice': 'warning', '#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#layer_up': 'go_up', '#url_notice': 'warning',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok', '#layer_up': 'go_up',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel', '#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#rwidthLabel, #iwidthLabel': 'width', '#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#rheightLabel, #iheightLabel': 'height', '#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right', '#rwidthLabel, #iwidthLabel': 'width',
'.dropdown button, #main_button .dropdown': 'arrow_down', '#rheightLabel, #iheightLabel': 'height',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color' '#cornerRadiusLabel span': 'c_radius',
}, '#angleLabel': 'angle',
resize: { '#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#logo .svg_icon': 28, '#zoomLabel': 'zoom',
'.flyout_arrow_horiz .svg_icon': 5, '#tool_fill label': 'fill',
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14, '#tool_stroke .icon_label': 'stroke',
'.dropdown button .svg_icon': 7, '#group_opacityLabel': 'opacity',
'#main_button .dropdown .svg_icon': 9, '#blurLabel': 'blur',
'.palette_item:first .svg_icon': 15, '#font_sizeLabel': 'fontsize',
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
async callback (icons) {
$('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
$(this).parent().prepend(this);
});
const tleft = $('#tools_left'); '.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
async callback (icons) {
$('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
$(this).parent().prepend(this);
});
let minHeight; const tleft = $('#tools_left');
if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
const size = $.pref('iconsize'); let minHeight;
editor.setIconSize(size || ($(window).height() < minHeight ? 's' : 'm')); if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
// Look for any missing flyout icons from plugins const size = $.pref('iconsize');
$('.tools_flyout').each(function () { editor.setIconSize(size || ($(window).height() < minHeight ? 's' : 'm'));
const shower = $('#' + this.id + '_show');
const sel = shower.attr('data-curopt'); // Look for any missing flyout icons from plugins
// Check if there's an icon here $('.tools_flyout').each(function () {
if (!shower.children('svg, img').length) { const shower = $('#' + this.id + '_show');
const clone = $(sel).children().clone(); const sel = shower.attr('data-curopt');
if (clone.length) { // Check if there's an icon here
clone[0].removeAttribute('style'); // Needed for Opera if (!shower.children('svg, img').length) {
shower.append(clone); const clone = $(sel).children().clone();
if (clone.length) {
clone[0].removeAttribute('style'); // Needed for Opera
shower.append(clone);
}
}
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
function getStylesheetPriority (stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
case 'jgraduate/css/jGraduate.css':
return 2;
case 'svg-editor.css':
return 3;
case 'spinbtn/jQuery.SpinButton.css':
return 4;
default:
return Infinity;
} }
} }
}); let stylesheets = $.loadingStylesheets.sort((a, b) => {
const priorityA = getStylesheetPriority(a);
/** const priorityB = getStylesheetPriority(b);
* Since stylesheets may be added out of order, we indicate the desired order if (priorityA === priorityB) {
* for defaults and others after them (in an indeterminate order). return 0;
* @param {string} stylesheetFile }
* @returns {Integer|PositiveInfinity} return priorityA > priorityB;
*/ });
function getStylesheetPriority (stylesheetFile) { if (curConfig.stylesheets.length) {
switch (stylesheetFile) { // Ensure a copy with unique items
case 'jgraduate/css/jPicker.css': stylesheets = [...new Set(curConfig.stylesheets)];
return 1; const idx = stylesheets.indexOf('@default');
case 'jgraduate/css/jGraduate.css': if (idx > -1) {
return 2; stylesheets.splice(idx, 1, ...$.loadingStylesheets);
case 'svg-editor.css':
return 3;
case 'spinbtn/jQuery.SpinButton.css':
return 4;
default:
return Infinity;
}
}
let stylesheets = $.loadingStylesheets.sort((a, b) => {
const priorityA = getStylesheetPriority(a);
const priorityB = getStylesheetPriority(b);
if (priorityA === priorityB) {
return 0;
}
return priorityA > priorityB;
});
if (curConfig.stylesheets.length) {
// Ensure a copy with unique items
stylesheets = [...new Set(curConfig.stylesheets)];
const idx = stylesheets.indexOf('@default');
if (idx > -1) {
stylesheets.splice(idx, 1, ...$.loadingStylesheets);
}
}
await loadStylesheets(stylesheets, {
acceptErrors ({stylesheetURL, reject, resolve}) {
if ($.loadingStylesheets.includes(stylesheetURL)) {
reject(new Error(`Missing expected stylesheet: ${stylesheetURL}`));
return;
} }
resolve();
} }
}); await loadStylesheets(stylesheets, {
$('#svg_container')[0].style.visibility = 'visible'; acceptErrors ({stylesheetURL, reject, resolve}) {
await editor.runCallbacks(); if ($.loadingStylesheets.includes(stylesheetURL)) {
} reject(new Error(`Missing expected stylesheet: ${stylesheetURL}`));
}); return;
}
resolve();
}
});
$('#svg_container')[0].style.visibility = 'visible';
await editor.runCallbacks();
}
});
}
/** /**
* @name module:SVGEditor.canvas * @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}
@ -6294,7 +6301,9 @@ editor.init = function () {
if (document.location.protocol === 'file:') { if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100); setTimeout(extAndLocaleFunc, 100);
} else { } else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this) // Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc(); extAndLocaleFunc();
} }
}; };

View File

@ -29423,8 +29423,10 @@
ok: ok, ok: ok,
cancel: cancel cancel: cancel
}); });
_context3.prev = 9; setIcons(); // Wait for dbox as needed for i18n
_context3.next = 12;
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
@ -29498,7 +29500,7 @@
}; };
}())); }()));
case 12: case 13:
svgCanvas.bind('extensions_added', svgCanvas.bind('extensions_added',
/** /**
* @param {external:Window} win * @param {external:Window} win
@ -29528,21 +29530,21 @@
}); });
}); });
svgCanvas.call('extensions_added'); svgCanvas.call('extensions_added');
_context3.next = 19; _context3.next = 20;
break; break;
case 16: case 17:
_context3.prev = 16; _context3.prev = 17;
_context3.t0 = _context3["catch"](9); _context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI // Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console console.log(_context3.t0); // eslint-disable-line no-console
case 19: case 20:
case "end": case "end":
return _context3.stop(); return _context3.stop();
} }
} }
}, _callee3, this, [[9, 16]]); }, _callee3, this, [[10, 17]]);
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
@ -29849,300 +29851,307 @@
setFlyoutPositions(); setFlyoutPositions();
}; };
/**
* Setup SVG icons
*/
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
id_match: false,
no_img: !isWebkit(),
// Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
return regeneratorRuntime.wrap(function _callee4$(_context4) { function setIcons() {
while (1) { $$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
switch (_context4.prev = _context4.next) { w: 24,
case 0: h: 24,
getStylesheetPriority = function _ref8(stylesheetFile) { id_match: false,
switch (stylesheetFile) { no_img: !isWebkit(),
case 'jgraduate/css/jPicker.css': // Opera & Firefox 4 gives odd behavior w/images
return 1; fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
case 'jgraduate/css/jGraduate.css': return regeneratorRuntime.wrap(function _callee4$(_context4) {
return 2; while (1) {
switch (_context4.prev = _context4.next) {
case 0:
getStylesheetPriority = function _ref8(stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
case 'svg-editor.css': case 'jgraduate/css/jGraduate.css':
return 3; return 2;
case 'spinbtn/jQuery.SpinButton.css': case 'svg-editor.css':
return 4; return 3;
default: case 'spinbtn/jQuery.SpinButton.css':
return Infinity; return 4;
}
};
$$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () { default:
$$b(this).parent().prepend(this); return Infinity;
});
tleft = $$b('#tools_left');
if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
size = $$b.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () {
var shower = $$b('#' + this.id + '_show');
var sel = shower.attr('data-curopt'); // Check if there's an icon here
if (!shower.children('svg, img').length) {
var clone = $$b(sel).children().clone();
if (clone.length) {
clone[0].removeAttribute('style'); // Needed for Opera
shower.append(clone);
} }
} };
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) { $$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
var priorityA = getStylesheetPriority(a); $$b(this).parent().prepend(this);
var priorityB = getStylesheetPriority(b); });
tleft = $$b('#tools_left');
if (priorityA === priorityB) { if (tleft.length) {
return 0; minHeight = tleft.offset().top + tleft.outerHeight();
} }
return priorityA > priorityB; size = $$b.pref('iconsize');
}); editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
if (curConfig.stylesheets.length) { $$b('.tools_flyout').each(function () {
// Ensure a copy with unique items var shower = $$b('#' + this.id + '_show');
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets)); var sel = shower.attr('data-curopt'); // Check if there's an icon here
idx = stylesheets.indexOf('@default');
if (idx > -1) { if (!shower.children('svg, img').length) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets))); var clone = $$b(sel).children().clone();
}
}
_context4.next = 11; if (clone.length) {
return loadStylesheets(stylesheets, { clone[0].removeAttribute('style'); // Needed for Opera
acceptErrors: function acceptErrors(_ref7) {
var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { shower.append(clone);
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); }
return; }
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) {
var priorityA = getStylesheetPriority(a);
var priorityB = getStylesheetPriority(b);
if (priorityA === priorityB) {
return 0;
} }
resolve(); return priorityA > priorityB;
});
if (curConfig.stylesheets.length) {
// Ensure a copy with unique items
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets));
idx = stylesheets.indexOf('@default');
if (idx > -1) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets)));
}
} }
});
case 11: _context4.next = 11;
$$b('#svg_container')[0].style.visibility = 'visible'; return loadStylesheets(stylesheets, {
_context4.next = 14; acceptErrors: function acceptErrors(_ref7) {
return editor.runCallbacks(); var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
case 14: if ($$b.loadingStylesheets.includes(stylesheetURL)) {
case "end": reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
return _context4.stop(); return;
}
resolve();
}
});
case 11:
$$b('#svg_container')[0].style.visibility = 'visible';
_context4.next = 14;
return editor.runCallbacks();
case 14:
case "end":
return _context4.stop();
}
} }
} }, _callee4, this);
}, _callee4, this); }));
}));
function callback(_x3) { function callback(_x3) {
return _callback.apply(this, arguments); return _callback.apply(this, arguments);
} }
return callback; return callback;
}() }()
}); });
}
/** /**
* @name module:SVGEditor.canvas * @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}
*/ */
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig); editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item? var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'], '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36148,7 +36157,9 @@
if (document.location.protocol === 'file:') { if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100); setTimeout(extAndLocaleFunc, 100);
} else { } else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this) // Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc(); extAndLocaleFunc();
} }
}; };

View File

@ -29423,8 +29423,10 @@
ok: ok, ok: ok,
cancel: cancel cancel: cancel
}); });
_context3.prev = 9; setIcons(); // Wait for dbox as needed for i18n
_context3.next = 12;
_context3.prev = 10;
_context3.next = 13;
return Promise.all(curConfig.extensions.map( return Promise.all(curConfig.extensions.map(
/*#__PURE__*/ /*#__PURE__*/
function () { function () {
@ -29498,7 +29500,7 @@
}; };
}())); }()));
case 12: case 13:
svgCanvas.bind('extensions_added', svgCanvas.bind('extensions_added',
/** /**
* @param {external:Window} win * @param {external:Window} win
@ -29528,21 +29530,21 @@
}); });
}); });
svgCanvas.call('extensions_added'); svgCanvas.call('extensions_added');
_context3.next = 19; _context3.next = 20;
break; break;
case 16: case 17:
_context3.prev = 16; _context3.prev = 17;
_context3.t0 = _context3["catch"](9); _context3.t0 = _context3["catch"](10);
// Todo: Report errors through the UI // Todo: Report errors through the UI
console.log(_context3.t0); // eslint-disable-line no-console console.log(_context3.t0); // eslint-disable-line no-console
case 19: case 20:
case "end": case "end":
return _context3.stop(); return _context3.stop();
} }
} }
}, _callee3, this, [[9, 16]]); }, _callee3, this, [[10, 17]]);
})); }));
return function extAndLocaleFunc() { return function extAndLocaleFunc() {
@ -29849,300 +29851,307 @@
setFlyoutPositions(); setFlyoutPositions();
}; };
/**
* Setup SVG icons
*/
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24,
h: 24,
id_match: false,
no_img: !isWebkit(),
// Opera & Firefox 4 gives odd behavior w/images
fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
return regeneratorRuntime.wrap(function _callee4$(_context4) { function setIcons() {
while (1) { $$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
switch (_context4.prev = _context4.next) { w: 24,
case 0: h: 24,
getStylesheetPriority = function _ref8(stylesheetFile) { id_match: false,
switch (stylesheetFile) { no_img: !isWebkit(),
case 'jgraduate/css/jPicker.css': // Opera & Firefox 4 gives odd behavior w/images
return 1; fallback_path: curConfig.imgPath,
fallback: {
logo: 'logo.png',
select: 'select.png',
select_node: 'select_node.png',
square: 'square.png',
rect: 'rect.png',
fh_rect: 'freehand-square.png',
circle: 'circle.png',
ellipse: 'ellipse.png',
fh_ellipse: 'freehand-circle.png',
pencil: 'fhpath.png',
pen: 'line.png',
text: 'text.png',
path: 'path.png',
add_subpath: 'add_subpath.png',
close_path: 'closepath.png',
open_path: 'openpath.png',
image: 'image.png',
zoom: 'zoom.png',
arrow_right: 'flyouth.png',
arrow_right_big: 'arrow_right_big.png',
arrow_down: 'dropdown.gif',
fill: 'fill.png',
stroke: 'stroke.png',
opacity: 'opacity.png',
new_image: 'clear.png',
save: 'save.png',
export: 'export.png',
open: 'open.png',
import: 'import.png',
docprops: 'document-properties.png',
source: 'source.png',
wireframe: 'wireframe.png',
undo: 'undo.png',
redo: 'redo.png',
clone: 'clone.png',
delete: 'delete.png',
go_up: 'go-up.png',
go_down: 'go-down.png',
context_menu: 'context_menu.png',
move_bottom: 'move_bottom.png',
move_top: 'move_top.png',
to_path: 'to_path.png',
link_controls: 'link_controls.png',
reorient: 'reorient.png',
group_elements: 'shape_group_elements.png',
ungroup: 'shape_ungroup.png',
unlink_use: 'unlink_use.png',
width: 'width.png',
height: 'height.png',
c_radius: 'c_radius.png',
angle: 'angle.png',
blur: 'blur.png',
fontsize: 'fontsize.png',
align: 'align.png',
align_left: 'align-left.png',
align_center: 'align-center.png',
align_right: 'align-right.png',
align_top: 'align-top.png',
align_middle: 'align-middle.png',
align_bottom: 'align-bottom.png',
linecap_butt: 'linecap_butt.png',
linecap_square: 'linecap_square.png',
linecap_round: 'linecap_round.png',
linejoin_miter: 'linejoin_miter.png',
linejoin_bevel: 'linejoin_bevel.png',
linejoin_round: 'linejoin_round.png',
eye: 'eye.png',
no_color: 'no_color.png',
ok: 'save.png',
cancel: 'cancel.png',
warning: 'warning.png',
node_delete: 'node_delete.png',
node_clone: 'node_clone.png',
globe_link: 'globe_link.png'
},
placement: {
'#logo': 'logo',
'#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_source': 'source',
'#tool_docprops > div': 'docprops',
'#tool_wireframe': 'wireframe',
'#tool_undo': 'undo',
'#tool_redo': 'redo',
'#tool_select': 'select',
'#tool_fhpath': 'pencil',
'#tool_line': 'pen',
'#tool_rect,#tools_rect_show': 'rect',
'#tool_square': 'square',
'#tool_fhrect': 'fh_rect',
'#tool_ellipse,#tools_ellipse_show': 'ellipse',
'#tool_circle': 'circle',
'#tool_fhellipse': 'fh_ellipse',
'#tool_path': 'path',
'#tool_text,#layer_rename': 'text',
'#tool_image': 'image',
'#tool_zoom': 'zoom',
'#tool_clone,#tool_clone_multi': 'clone',
'#tool_node_clone': 'node_clone',
'#layer_delete,#tool_delete,#tool_delete_multi': 'delete',
'#tool_node_delete': 'node_delete',
'#tool_add_subpath': 'add_subpath',
'#tool_openclose_path': 'open_path',
'#tool_move_top': 'move_top',
'#tool_move_bottom': 'move_bottom',
'#tool_topath': 'to_path',
'#tool_node_link': 'link_controls',
'#tool_reorient': 'reorient',
'#tool_group_elements': 'group_elements',
'#tool_ungroup': 'ungroup',
'#tool_unlink_use': 'unlink_use',
'#tool_alignleft, #tool_posleft': 'align_left',
'#tool_aligncenter, #tool_poscenter': 'align_center',
'#tool_alignright, #tool_posright': 'align_right',
'#tool_aligntop, #tool_postop': 'align_top',
'#tool_alignmiddle, #tool_posmiddle': 'align_middle',
'#tool_alignbottom, #tool_posbottom': 'align_bottom',
'#cur_position': 'align',
'#linecap_butt,#cur_linecap': 'linecap_butt',
'#linecap_round': 'linecap_round',
'#linecap_square': 'linecap_square',
'#linejoin_miter,#cur_linejoin': 'linejoin_miter',
'#linejoin_round': 'linejoin_round',
'#linejoin_bevel': 'linejoin_bevel',
'#url_notice': 'warning',
'#layer_up': 'go_up',
'#layer_down': 'go_down',
'#layer_moreopts': 'context_menu',
'#layerlist td.layervis': 'eye',
'#tool_source_save,#tool_docprops_save,#tool_prefs_save': 'ok',
'#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel': 'cancel',
'#rwidthLabel, #iwidthLabel': 'width',
'#rheightLabel, #iheightLabel': 'height',
'#cornerRadiusLabel span': 'c_radius',
'#angleLabel': 'angle',
'#linkLabel,#tool_make_link,#tool_make_link_multi': 'globe_link',
'#zoomLabel': 'zoom',
'#tool_fill label': 'fill',
'#tool_stroke .icon_label': 'stroke',
'#group_opacityLabel': 'opacity',
'#blurLabel': 'blur',
'#font_sizeLabel': 'fontsize',
'.flyout_arrow_horiz': 'arrow_right',
'.dropdown button, #main_button .dropdown': 'arrow_down',
'#palette .palette_item:first, #fill_bg, #stroke_bg': 'no_color'
},
resize: {
'#logo .svg_icon': 28,
'.flyout_arrow_horiz .svg_icon': 5,
'.layer_button .svg_icon, #layerlist td.layervis .svg_icon': 14,
'.dropdown button .svg_icon': 7,
'#main_button .dropdown .svg_icon': 9,
'.palette_item:first .svg_icon': 15,
'#fill_bg .svg_icon, #stroke_bg .svg_icon': 16,
'.toolbar_button button .svg_icon': 16,
'.stroke_tool div div .svg_icon': 20,
'#tools_bottom label .svg_icon': 18
},
callback: function () {
var _callback = _asyncToGenerator(
/*#__PURE__*/
regeneratorRuntime.mark(function _callee4(icons) {
var tleft, minHeight, size, getStylesheetPriority, stylesheets, idx, _stylesheets;
case 'jgraduate/css/jGraduate.css': return regeneratorRuntime.wrap(function _callee4$(_context4) {
return 2; while (1) {
switch (_context4.prev = _context4.next) {
case 0:
getStylesheetPriority = function _ref8(stylesheetFile) {
switch (stylesheetFile) {
case 'jgraduate/css/jPicker.css':
return 1;
case 'svg-editor.css': case 'jgraduate/css/jGraduate.css':
return 3; return 2;
case 'spinbtn/jQuery.SpinButton.css': case 'svg-editor.css':
return 4; return 3;
default: case 'spinbtn/jQuery.SpinButton.css':
return Infinity; return 4;
}
};
$$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () { default:
$$b(this).parent().prepend(this); return Infinity;
});
tleft = $$b('#tools_left');
if (tleft.length) {
minHeight = tleft.offset().top + tleft.outerHeight();
}
size = $$b.pref('iconsize');
editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
$$b('.tools_flyout').each(function () {
var shower = $$b('#' + this.id + '_show');
var sel = shower.attr('data-curopt'); // Check if there's an icon here
if (!shower.children('svg, img').length) {
var clone = $$b(sel).children().clone();
if (clone.length) {
clone[0].removeAttribute('style'); // Needed for Opera
shower.append(clone);
} }
} };
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) { $$b('.toolbar_button button > svg, .toolbar_button button > img').each(function () {
var priorityA = getStylesheetPriority(a); $$b(this).parent().prepend(this);
var priorityB = getStylesheetPriority(b); });
tleft = $$b('#tools_left');
if (priorityA === priorityB) { if (tleft.length) {
return 0; minHeight = tleft.offset().top + tleft.outerHeight();
} }
return priorityA > priorityB; size = $$b.pref('iconsize');
}); editor.setIconSize(size || ($$b(window).height() < minHeight ? 's' : 'm')); // Look for any missing flyout icons from plugins
if (curConfig.stylesheets.length) { $$b('.tools_flyout').each(function () {
// Ensure a copy with unique items var shower = $$b('#' + this.id + '_show');
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets)); var sel = shower.attr('data-curopt'); // Check if there's an icon here
idx = stylesheets.indexOf('@default');
if (idx > -1) { if (!shower.children('svg, img').length) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets))); var clone = $$b(sel).children().clone();
}
}
_context4.next = 11; if (clone.length) {
return loadStylesheets(stylesheets, { clone[0].removeAttribute('style'); // Needed for Opera
acceptErrors: function acceptErrors(_ref7) {
var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
if ($$b.loadingStylesheets.includes(stylesheetURL)) { shower.append(clone);
reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL))); }
return; }
});
/**
* Since stylesheets may be added out of order, we indicate the desired order
* for defaults and others after them (in an indeterminate order).
* @param {string} stylesheetFile
* @returns {Integer|PositiveInfinity}
*/
stylesheets = $$b.loadingStylesheets.sort(function (a, b) {
var priorityA = getStylesheetPriority(a);
var priorityB = getStylesheetPriority(b);
if (priorityA === priorityB) {
return 0;
} }
resolve(); return priorityA > priorityB;
});
if (curConfig.stylesheets.length) {
// Ensure a copy with unique items
stylesheets = _toConsumableArray(new Set(curConfig.stylesheets));
idx = stylesheets.indexOf('@default');
if (idx > -1) {
(_stylesheets = stylesheets).splice.apply(_stylesheets, [idx, 1].concat(_toConsumableArray($$b.loadingStylesheets)));
}
} }
});
case 11: _context4.next = 11;
$$b('#svg_container')[0].style.visibility = 'visible'; return loadStylesheets(stylesheets, {
_context4.next = 14; acceptErrors: function acceptErrors(_ref7) {
return editor.runCallbacks(); var stylesheetURL = _ref7.stylesheetURL,
reject = _ref7.reject,
resolve = _ref7.resolve;
case 14: if ($$b.loadingStylesheets.includes(stylesheetURL)) {
case "end": reject(new Error("Missing expected stylesheet: ".concat(stylesheetURL)));
return _context4.stop(); return;
}
resolve();
}
});
case 11:
$$b('#svg_container')[0].style.visibility = 'visible';
_context4.next = 14;
return editor.runCallbacks();
case 14:
case "end":
return _context4.stop();
}
} }
} }, _callee4, this);
}, _callee4, this); }));
}));
function callback(_x3) { function callback(_x3) {
return _callback.apply(this, arguments); return _callback.apply(this, arguments);
} }
return callback; return callback;
}() }()
}); });
}
/** /**
* @name module:SVGEditor.canvas * @name module:SVGEditor.canvas
* @type {module:svgcanvas.SvgCanvas} * @type {module:svgcanvas.SvgCanvas}
*/ */
editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig); editor.canvas = svgCanvas = new SvgCanvas(document.getElementById('svgcanvas'), curConfig);
var palette = [// Todo: Make into configuration item? var palette = [// Todo: Make into configuration item?
'#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'], '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', '#ff0000', '#ff7f00', '#ffff00', '#7fff00', '#00ff00', '#00ff7f', '#00ffff', '#007fff', '#0000ff', '#7f00ff', '#ff00ff', '#ff007f', '#7f0000', '#7f3f00', '#7f7f00', '#3f7f00', '#007f00', '#007f3f', '#007f7f', '#003f7f', '#00007f', '#3f007f', '#7f007f', '#7f003f', '#ffaaaa', '#ffd4aa', '#ffffaa', '#d4ffaa', '#aaffaa', '#aaffd4', '#aaffff', '#aad4ff', '#aaaaff', '#d4aaff', '#ffaaff', '#ffaad4'],
@ -36148,7 +36157,9 @@
if (document.location.protocol === 'file:') { if (document.location.protocol === 'file:') {
setTimeout(extAndLocaleFunc, 100); setTimeout(extAndLocaleFunc, 100);
} else { } else {
// Returns a promise (if we wanted to fire 'extensions-loaded' event, potentially useful to hide interface as some extension locales are only available after this) // Returns a promise (if we wanted to fire 'extensions-loaded' event,
// potentially useful to hide interface as some extension locales
// are only available after this)
extAndLocaleFunc(); extAndLocaleFunc();
} }
}; };