svgedit/packages/svgcanvas/layer.js

229 lines
6.4 KiB
JavaScript
Raw Normal View History

/**
* Provides tools for the layer concept.
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @module layer
* @license MIT
*
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @copyright 2011 Jeff Schiller, 2016 Flint O'Brien
*/
import { NS } from './namespaces.js'
import { toXml, walkTree } from './utilities.js'
/**
* This class encapsulates the concept of a layer in the drawing. It can be constructed with
* an existing group element or, with three parameters, will create a new layer group element.
*
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @example
* const l1 = new Layer('name', group); // Use the existing group for this layer.
* const l2 = new Layer('name', group, svgElem); // Create a new group and add it to the DOM after group.
* const l3 = new Layer('name', null, svgElem); // Create a new group and add it to the DOM as the last layer.
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @memberof module:layer
*/
class Layer {
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
/**
* @param {string} name - Layer name
* @param {SVGGElement|null} group - An existing SVG group element or null.
* If group and no svgElem, use group for this layer.
* If group and svgElem, create a new group element and insert it in the DOM after group.
* If no group and svgElem, create a new group element and insert it in the DOM as the last layer.
* @param {SVGGElement} [svgElem] - The SVG DOM element. If defined, use this to add
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* a new layer to the document.
*/
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
constructor (name, group, svgElem) {
this.name_ = name
this.group_ = svgElem ? null : group
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
if (svgElem) {
// Create a group element with title and add it to the DOM.
const svgdoc = svgElem.ownerDocument
this.group_ = svgdoc.createElementNS(NS.SVG, 'g')
const layerTitle = svgdoc.createElementNS(NS.SVG, 'title')
layerTitle.textContent = name
this.group_.append(layerTitle)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
if (group) {
group.insertAdjacentElement('afterend', this.group_)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
} else {
svgElem.append(this.group_)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
}
addLayerClass(this.group_)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
walkTree(this.group_, function (e) {
e.setAttribute('style', 'pointer-events:inherit')
})
this.group_.setAttribute('style', svgElem ? 'pointer-events:all' : 'pointer-events:none')
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Get the layer's name.
* @returns {string} The layer name
*/
getName () {
return this.name_
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Get the group element for this layer.
* @returns {SVGGElement} The layer SVG group
*/
getGroup () {
return this.group_
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Active this layer so it takes pointer events.
* @returns {void}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
activate () {
this.group_.setAttribute('style', 'pointer-events:all')
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Deactive this layer so it does NOT take pointer events.
* @returns {void}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
deactivate () {
this.group_.setAttribute('style', 'pointer-events:none')
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Set this layer visible or hidden based on 'visible' parameter.
* @param {boolean} visible - If true, make visible; otherwise, hide it.
* @returns {void}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
setVisible (visible) {
const expected = visible === undefined || visible ? 'inline' : 'none'
const oldDisplay = this.group_.getAttribute('display')
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
if (oldDisplay !== expected) {
this.group_.setAttribute('display', expected)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Is this layer visible?
* @returns {boolean} True if visible.
*/
isVisible () {
return this.group_.getAttribute('display') !== 'none'
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Get layer opacity.
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @returns {Float} Opacity value.
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
getOpacity () {
const opacity = this.group_.getAttribute('opacity')
if (!opacity) {
return 1
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
return Number.parseFloat(opacity)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Sets the opacity of this layer. If opacity is not a value between 0.0 and 1.0,
* nothing happens.
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @param {Float} opacity - A float value in the range 0.0-1.0
* @returns {void}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
setOpacity (opacity) {
if (typeof opacity === 'number' && opacity >= 0.0 && opacity <= 1.0) {
this.group_.setAttribute('opacity', opacity)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Append children to this layer.
* @param {SVGGElement} children - The children to append to this layer.
* @returns {void}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
*/
appendChildren (children) {
for (const child of children) {
this.group_.append(child)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
}
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
/**
* @returns {SVGTitleElement|null}
*/
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
getTitleElement () {
const len = this.group_.childNodes.length
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
for (let i = 0; i < len; ++i) {
const child = this.group_.childNodes.item(i)
2022-01-05 13:44:47 +00:00
if (child?.tagName === 'title') {
return child
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
}
return null
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Set the name of this layer.
* @param {string} name - The new name.
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* @param {module:history.HistoryRecordingService} hrService - History recording service
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
* @returns {string|null} The new name if changed; otherwise, null.
*/
setName (name, hrService) {
const previousName = this.name_
name = toXml(name)
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
// now change the underlying title element contents
const title = this.getTitleElement()
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
if (title) {
while (title.firstChild) { title.removeChild(title.firstChild) }
title.textContent = name
this.name_ = name
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
if (hrService) {
hrService.changeElement(title, { '#text': previousName })
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
return this.name_
}
return null
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
/**
* Remove this layer's group from the DOM. No more functions on group can be called after this.
* @returns {SVGGElement} The layer SVG group that was just removed.
*/
removeGroup () {
const group = this.group_
this.group_.remove()
this.group_ = undefined
return group
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
2021-05-09 17:29:45 +00:00
/**
* Test whether an element is a layer or not.
* @param {SVGGElement} elem - The SVGGElement to test.
* @returns {boolean} True if the element is a layer
*/
static isLayer (elem) {
return elem && elem.tagName === 'g' && Layer.CLASS_REGEX.test(elem.getAttribute('class'))
2021-05-09 17:29:45 +00:00
}
(INCOMPLETE: ES6 Module conversion and linting) - Breaking change: Require `new` with `EmbeddedSVGEdit` (allows us to use `class` internally) - Breaking change: If `svgcanvas.setUiStrings` must now be called if not using editor in order to get strings (for sake of i18n) (and if using path.js alone, must also have its `setUiStrings` called) - Breaking change (ext-overview-window): Avoid global `overviewWindowGlobals` - Breaking change (ext-imagelib): Change to object-based encoding for namespacing of messages (though keep stringifying/parsing ourselves until we remove IE9 support) - Breaking change: Rename `jquery.js` to `jquery.min.js` - Breaking change: Remove `scoped` attribute from `style`; it is now deprecated and obsolete; also move to head (after other stylesheets) - Enhancement: Make SpinButton plugin independent of SVGEdit via generic state object for tool_scale - Enhancement: Remove now unused Python l10n scripts (#238) - Enhancement: ES6 Modules (including jQuery plugins but not jQuery) - Enhancement: Further JSDoc (incomplete) - Enhancement (Optimization): Compress images using imageoptim (and add npm script) (per #215) - Fix: i18nize path.js strings and canvas notifications - Fix: Attempt i18n for ext-markers - Refactoring (ext-storage): Move locale info to own file imported by the extension (toward modularity; still should be split into separate files by language and *dynamically* imported, but we'll wait for better `import` support to refactor this) - Refactoring: For imagelib, add local jQuery copy (using old 1.4.4 as had been using from server) - Refactoring: For MathJax, add local copy (using old 2.3 as had been using from server); server had not been working - Refactoring: Remove `use strict` (implicit in modules) - Refactoring: Remove trailing whitespace, fix some code within comments - Refactoring: Expect `jQuery` global rather than `$` for better modularity (also to adapt line later once available via `import`) - Refactoring: Prefer `const` (and then `let`) - Refactoring: Add block scope keywords closer to first block in which they appear - Refactoring: Use ES6 `class` - Refactoring `$.isArray` -> `Array.isArray` and avoid some other jQuery core methods with simple VanillaJS replacements - Refactoring: Use abbreviated object property syntax - Refactoring: Object destructuring - Refactoring: Remove `uiStrings` contents in svg-editor.js (obtains from locale) - Refactoring: Add favicon to embedded API file - Refactoring: Use arrow functions for brief functions (incomplete) - Refactoring: Use `Array.prototype.includes`/`String.prototype.includes`; `String.prototype.startsWith`, `String.prototype.trim` - Refactoring: Remove now unnecessary svgutils do/while resetting of variables - Refactoring: Use shorthand methods for object literals (avoid ": function") - Refactoring: Avoid quoting object property keys where unnecessary - Refactoring: Just do truthy/falsey check for lengths in place of comparison to 0 - Refactoring (Testing): Avoid jQuery usage within most test files (defer script, also in preparation for future switch to ES6 modules for tests) - Refactoring: Make jpicker variable declaration indent bearable - Refactoring (Linting): Finish svgcanvas.js - Docs: Mention in comment no longer an entry file as before - Docs: Migrate old config, extensions, and FAQ docs - Licensing: Indicate MIT is license type of rgbcolor; rename/add license file name for jgraduate and screencast to reflect type (Apache 2.0); rename file to reflect it contains license information (of type MIT) for Raphael icons
2018-05-18 03:25:45 +00:00
}
2016-05-02 22:33:45 +00:00
/**
2018-05-29 08:39:29 +00:00
* @property {string} CLASS_NAME - class attribute assigned to all layer groups.
2016-05-02 22:33:45 +00:00
*/
Layer.CLASS_NAME = 'layer'
/**
2018-05-29 08:39:29 +00:00
* @property {RegExp} CLASS_REGEX - Used to test presence of class Layer.CLASS_NAME
*/
Layer.CLASS_REGEX = new RegExp('(\\s|^)' + Layer.CLASS_NAME + '(\\s|$)')
/**
- Security fix: 'extPath', 'imgPath', 'extIconsPath', 'canvgPath', 'langPath', 'jGraduatePath', and 'jspdfPath' were not being prevented - Breaking change: Rename "svgutils.js" to "utilities.js" (make in conformity with JSDoc module naming convention) - Breaking change: Rename "svgedit.js" to "namespaces.js" (to make clear purpose and avoid confusing with editor) - Breaking change: Rename "jquery-svg.js" to "jQuery.attr.js" - Breaking change: Rename "jquery.contextMenu.js" to "jQuery.contextMenu.js" - Breaking change: Rename "jquery.jpicker.js" to "jQuery.jPicker.js" - Breaking change: Rename "JQuerySpinBtn.css" to "jQuery.SpinButton.css" - Breaking change: Rename "JQuerySpinBtn.js" to "jQuery.SpinButton.js" (to have file name more closely reflect name) - Breaking change: Rename "jquery.svgicons.js" to "jQuery.svgIcons.js" - Breaking change: Rename "jquery.jgraduate.js" to "jQuery.jGraduate.js" - Breaking change: Rename "pathseg.js" to "svgpathseg.js" (as it is a poyfill of SVGPathSeg) - Breaking change: Rename `addSvgElementFromJson()` to `addSVGElementFromJson` for consistency - Breaking change: Rename `changeSvgContent()` to `changeSVGContent()` for consistency - Breaking change: Have `exportPDF` resolve with `output` and `outputType` rather than `dataurlstring` (as type may vary) - Breaking change: Rename `extensions/mathjax/MathJax.js` to `extensions/mathjax/MathJax.min.js` - Breaking change: Avoid recent change to have editor ready callbacks return Promises (we're not using and advantageous to keep sequential) - Breaking change: Avoid recent addition of locale-side function in ext-imagelib for l10n - Breaking change: Change name of ext-arrows.js from `Arrows` to `arrows` for sake of file path (not localized anyways). - Breaking change: Change `addlangData` extension event to `addLangData` for consistency with method name - Breaking change: Have `readLang` return lang and data but do not call `setLang` - Fix: Have general locales load first so extensions may use - Fix: Provide `importLocale` to extensions `init` so it may delay adding of the extension until locale data loaded - Fix: Ensure call to `rasterExport` without `imgType` properly sets MIME type to PNG - Fix: Wrong name for moinsave - Update: Update WebAppFind per new API changes - Enhancement: Make `setStrings` public on editor for late setting (used by `ext-shapes.js`) - Enhancement: Add `extensions_added` event - Enhancement: Add `message` event (Relay messages including those which have been been received prior to extension load) - Enhancement: Allow SVGEdit to work out of the box--avoid need for copying sample config file. Should also help with Github-based file servers - Enhancement: Allow avoiding "name" in extension export (just extract out of file name) - Enhancement: Add stack blur to canvg by default (and refactoring it) - Enhancement: Return `Promise` for `embedImage` (as with some other loading methods) - Enhancement: Supply `importLocale` to `langReady` to facilitate extension locale loading - Enhancement: Recover if an extension fails to load (just log and otherwise ignore) - Enhancement: More i18n of extensions (also fixed issue with some console warnings about missing locale strings); i18nize Hello World too - Enhancement: Allowing importing of locales within `addLangData` - npm: Update devDeps - Docs: Migrate copies of all old wiki pages to docs/from-old-wiki folder; intended for a possible move to Markdown, so raw HTML (with formatting) was not preserved, though named links had their absolute URL links preserved - Docs: Begin deleting `SvgCanvas.md` as ensuring jsdoc has replacements - Docs: Add Edtior doc file for help to general users - Docs: Clarify/simplify install instructions - npm/Docs (JSDoc): Add script to check for overly generic types - Docs (JSDoc): For config/prefs and extension creating, link to tutorials (moved tutorials to own directory to avoid recursion problems by jsdoc) - Docs (JSDoc): Add modules (upper case for usual main entrance files or regular names) - Docs (JSDoc): Fill out missing areas; indicate return of `undefined`; consistency with `@returns` - Docs (JSDoc): Add our own layout template to support overflow - Docs (JSDoc): Use cleverLinks and disallow unknown tags - Docs (JSDoc): Insist on "pedantic" flag; put output directory in config - Docs (JSDoc): Use more precise Integer/Float over number, the specific type of array/function/object - Docs (JSDoc): Use `@throws`, `@enum`, `@event`/`@fires`/`@listens` - Docs: Generally update/improve docs (fixes #92) - Docs: Update links to `latest` path (Avoid needing to update such references upon each release) - Docs: 80 chars max - Refactoring: Drop code for extension as function (already requiring export to be an object) - Refactoring: Object destructuring, `Object.entries`, Object shorthand, array extras, more camelCase variable names - Refactoring: Add a `Command` base class - Refactoring: Simplify svgicons `callback` ready detection - Refactoring: Put `let` or `const` closer to scope - Refactoring: Remove unneeded `delimiter` from regex escaping utility - Refactoring: Clearer variable names - Refactoring: Use (non-deprecated) Event constructors - Testing: Use new Sinon
2018-06-06 07:26:20 +00:00
* Add class `Layer.CLASS_NAME` to the element (usually `class='layer'`).
*
* @param {SVGGElement} elem - The SVG element to update
* @returns {void}
*/
function addLayerClass (elem) {
const classes = elem.getAttribute('class')
if (!classes || !classes.length) {
elem.setAttribute('class', Layer.CLASS_NAME)
} else if (!Layer.CLASS_REGEX.test(classes)) {
elem.setAttribute('class', classes + ' ' + Layer.CLASS_NAME)
}
}
export default Layer