2018-05-18 03:25:45 +00:00
|
|
|
/**
|
2010-11-05 16:15:56 +00:00
|
|
|
* jGraduate 0.4
|
2009-07-30 22:45:59 +00:00
|
|
|
*
|
|
|
|
* jQuery Plugin for a gradient picker
|
|
|
|
*
|
- 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 jGraduate
|
|
|
|
* @copyright 2010 Jeff Schiller {@link http://blog.codedread.com/}, 2010 Alexis Deveria {@link http://a.deveria.com/}
|
2009-07-30 22:45:59 +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
|
|
|
* @license Apache-2.0
|
|
|
|
* @example
|
|
|
|
* // The Paint object is described below.
|
|
|
|
* $.jGraduate.Paint() // constructs a 'none' color
|
|
|
|
* @example $.jGraduate.Paint({copy: o}) // creates a copy of the paint o
|
|
|
|
* @example $.jGraduate.Paint({hex: '#rrggbb'}) // creates a solid color paint with hex = "#rrggbb"
|
|
|
|
* @example $.jGraduate.Paint({linearGradient: o, a: 50}) // creates a linear gradient paint with opacity=0.5
|
|
|
|
* @example $.jGraduate.Paint({radialGradient: o, a: 7}) // creates a radial gradient paint with opacity=0.07
|
|
|
|
* @example $.jGraduate.Paint({hex: '#rrggbb', linearGradient: o}) // throws an exception?
|
2009-07-30 22:45:59 +00:00
|
|
|
*
|
2018-05-13 10:47:00 +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
|
|
|
|
|
|
|
/**
|
|
|
|
* The jQuery namespace.
|
|
|
|
* @external jQuery
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* The jQuery plugin namespace.
|
|
|
|
* @namespace {PlainObject} fn
|
|
|
|
* @memberof external:jQuery
|
|
|
|
* @see {@link http://learn.jquery.com/plugins/|jQuery Plugins}
|
|
|
|
*/
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const ns = {
|
|
|
|
svg: 'http://www.w3.org/2000/svg',
|
|
|
|
xlink: 'http://www.w3.org/1999/xlink'
|
|
|
|
};
|
|
|
|
|
2018-05-13 10:47:00 +00:00
|
|
|
if (!window.console) {
|
2018-05-18 03:25:45 +00:00
|
|
|
window.console = {
|
2018-11-08 06:48:01 +00:00
|
|
|
log (str) { /* */ },
|
|
|
|
dir (str) { /* */ }
|
2018-05-18 03:25:45 +00:00
|
|
|
};
|
2009-07-30 22:45:59 +00:00
|
|
|
}
|
2009-11-13 20:45:18 +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
|
|
|
/**
|
2018-10-30 15:25:20 +00:00
|
|
|
* Adds {@link external:jQuery.jGraduate.Paint},
|
|
|
|
* {@link external:jQuery.fn.jGraduateDefaults},
|
|
|
|
* {@link external:jQuery.fn.jGraduate}.
|
- 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
|
|
|
* @function module:jGraduate.jGraduate
|
|
|
|
* @param {external:jQuery} $ The jQuery instance to wrap
|
|
|
|
* @returns {external:jQuery}
|
|
|
|
*/
|
2018-11-08 06:48:01 +00:00
|
|
|
export default function jQueryPluginJGraduate ($) {
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
if (!$.loadingStylesheets) {
|
|
|
|
$.loadingStylesheets = [];
|
|
|
|
}
|
- 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
|
|
|
const stylesheet = 'jgraduate/css/jGraduate.css';
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
if (!$.loadingStylesheets.includes(stylesheet)) {
|
|
|
|
$.loadingStylesheets.push(stylesheet);
|
|
|
|
}
|
- 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
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef {PlainObject} module:jGraduate.jGraduatePaintOptions
|
|
|
|
* @param {Float} [alpha]
|
|
|
|
* @param {module:jGraduate~Paint} [copy] Copy paint object
|
|
|
|
* @param {SVGLinearGradientElement} [linearGradient]
|
|
|
|
* @param {SVGRadialGradientElement} [radialGradient]
|
|
|
|
* @param {string} [solidColor]
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @memberof module:jGraduate~
|
|
|
|
*/
|
|
|
|
class Paint {
|
|
|
|
/**
|
|
|
|
* @param {module:jGraduate.jGraduatePaintOptions} [opt]
|
|
|
|
*/
|
|
|
|
constructor (opt) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const options = opt || {};
|
2018-05-18 06:23:36 +00:00
|
|
|
this.alpha = isNaN(options.alpha) ? 100 : options.alpha;
|
|
|
|
// copy paint object
|
|
|
|
if (options.copy) {
|
- 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
|
|
|
/**
|
|
|
|
* @name module:jGraduate~Paint#type
|
|
|
|
* @type {"none"|"solidColor"|"linearGradient"|"radialGradient"}
|
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
this.type = options.copy.type;
|
- 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
|
|
|
/**
|
|
|
|
* Represents opacity (0-100)
|
|
|
|
* @name module:jGraduate~Paint#alpha
|
|
|
|
* @type {Float}
|
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
this.alpha = options.copy.alpha;
|
- 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
|
|
|
/**
|
|
|
|
* Represents #RRGGBB hex of color
|
|
|
|
* @name module:jGraduate~Paint#solidColor
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
this.solidColor = null;
|
- 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
|
|
|
/**
|
|
|
|
* @name module:jGraduate~Paint#linearGradient
|
|
|
|
* @type {SVGLinearGradientElement}
|
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
this.linearGradient = null;
|
- 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
|
|
|
/**
|
|
|
|
* @name module:jGraduate~Paint#radialGradient
|
|
|
|
* @type {SVGRadialGradientElement}
|
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
this.radialGradient = null;
|
|
|
|
|
|
|
|
switch (this.type) {
|
|
|
|
case 'none':
|
|
|
|
break;
|
|
|
|
case 'solidColor':
|
|
|
|
this.solidColor = options.copy.solidColor;
|
|
|
|
break;
|
|
|
|
case 'linearGradient':
|
|
|
|
this.linearGradient = options.copy.linearGradient.cloneNode(true);
|
|
|
|
break;
|
|
|
|
case 'radialGradient':
|
|
|
|
this.radialGradient = options.copy.radialGradient.cloneNode(true);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// create linear gradient paint
|
|
|
|
} else if (options.linearGradient) {
|
|
|
|
this.type = 'linearGradient';
|
|
|
|
this.solidColor = null;
|
|
|
|
this.radialGradient = null;
|
|
|
|
this.linearGradient = options.linearGradient.cloneNode(true);
|
|
|
|
// create linear gradient paint
|
|
|
|
} else if (options.radialGradient) {
|
|
|
|
this.type = 'radialGradient';
|
|
|
|
this.solidColor = null;
|
|
|
|
this.linearGradient = null;
|
|
|
|
this.radialGradient = options.radialGradient.cloneNode(true);
|
|
|
|
// create solid color paint
|
|
|
|
} else if (options.solidColor) {
|
|
|
|
this.type = 'solidColor';
|
|
|
|
this.solidColor = options.solidColor;
|
|
|
|
// create empty paint
|
|
|
|
} else {
|
|
|
|
this.type = 'none';
|
|
|
|
this.solidColor = null;
|
|
|
|
this.linearGradient = null;
|
|
|
|
this.radialGradient = null;
|
|
|
|
}
|
|
|
|
}
|
- 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
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @namespace {PlainObject} jGraduate
|
|
|
|
* @memberof external:jQuery
|
|
|
|
*/
|
|
|
|
$.jGraduate = /** @lends external:jQuery.jGraduate */ {
|
|
|
|
/**
|
|
|
|
* @class external:jQuery.jGraduate.Paint
|
|
|
|
* @see module:jGraduate~Paint
|
|
|
|
*/
|
|
|
|
Paint
|
2018-05-18 03:25:45 +00:00
|
|
|
};
|
2009-07-30 22:45:59 +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
|
|
|
// JSDoc doesn't show this as belonging to our `module:jGraduate.Options` type,
|
|
|
|
// so we use `@see`
|
|
|
|
/**
|
|
|
|
* @namespace {module:jGraduate.Options} jGraduateDefaults
|
|
|
|
* @memberof external:jQuery.fn
|
|
|
|
*/
|
|
|
|
$.fn.jGraduateDefaults = /** @lends external:jQuery.fn.jGraduateDefaults */ {
|
|
|
|
/**
|
|
|
|
* Creates an object with a 'none' color
|
|
|
|
* @type {external:jQuery.jGraduate.Paint}
|
|
|
|
* @see module:jGraduate.Options
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
paint: new $.jGraduate.Paint(),
|
- 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
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
window: {
|
- 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
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
* @see module:jGraduate.Options
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
pickerTitle: 'Drag markers to pick a paint'
|
|
|
|
},
|
- 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
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
images: {
|
- 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
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
* @see module:jGraduate.Options
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
clientPath: 'images/'
|
|
|
|
},
|
- 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
|
|
|
/**
|
|
|
|
* @type {string}
|
|
|
|
* @see module:jGraduate.Options
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
newstop: 'inverse' // same, inverse, black, white
|
|
|
|
};
|
2009-07-30 22:45:59 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const isGecko = navigator.userAgent.includes('Gecko/');
|
2010-11-05 16:15:56 +00:00
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
* @typedef {PlainObject.<string, string>} module:jGraduate.Attrs
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @param {SVGElement} elem
|
|
|
|
* @param {module:jGraduate.Attrs} attrs
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
function setAttrs (elem, attrs) {
|
|
|
|
if (isGecko) {
|
2018-11-08 06:48:01 +00:00
|
|
|
Object.entries(attrs).forEach(([aname, val]) => {
|
|
|
|
elem.setAttribute(aname, val);
|
|
|
|
});
|
2018-05-18 03:25:45 +00:00
|
|
|
} else {
|
2018-11-08 06:48:01 +00:00
|
|
|
Object.entries(attrs).forEach(([aname, val]) => {
|
|
|
|
const prop = elem[aname];
|
2018-05-18 03:25:45 +00:00
|
|
|
if (prop && prop.constructor === 'SVGLength') {
|
|
|
|
prop.baseVal.value = val;
|
|
|
|
} else {
|
|
|
|
elem.setAttribute(aname, val);
|
|
|
|
}
|
2018-11-08 06:48:01 +00:00
|
|
|
});
|
2018-05-18 06:23:36 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-05 16:15:56 +00:00
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @param {module:jGraduate.Attrs} attrs
|
|
|
|
* @param {Element} newparent
|
|
|
|
* @returns {SVGElement}
|
|
|
|
*/
|
2018-05-18 03:25:45 +00:00
|
|
|
function mkElem (name, attrs, newparent) {
|
|
|
|
const elem = document.createElementNS(ns.svg, name);
|
|
|
|
setAttrs(elem, attrs);
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
if (newparent) {
|
|
|
|
newparent.append(elem);
|
|
|
|
}
|
2018-05-18 03:25:45 +00:00
|
|
|
return elem;
|
|
|
|
}
|
2010-11-05 16:15:56 +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
|
|
|
/**
|
|
|
|
* @typedef {PlainObject} module:jGraduate.ColorOpac Object may have one or both values
|
|
|
|
* @property {string} [color] #Hex color
|
|
|
|
* @property {Float} [opac] 0-1
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @typedef {PlainObject} module:jGraduate.Options
|
|
|
|
* @property {module:jGraduate~Paint} [paint] A Paint object object describing the paint to display initially; defaults to a new instance without options (defaults to opaque white)
|
|
|
|
* @property {external:Window} [window]
|
|
|
|
* @property {string} [window.pickerTitle='Drag markers to pick a paint']
|
|
|
|
* @property {PlainObject} [images]
|
|
|
|
* @property {string} [images.clientPath='images/']
|
|
|
|
* @property {"same"|"inverse"|"black"|"white"|module:jGraduate.ColorOpac} [newstop="inverse"]
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @callback external:jQuery.fn.jGraduate.OkCallback
|
|
|
|
* @param {external:jQuery.jGraduate.Paint} paint
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
- 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
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @callback external:jQuery.fn.jGraduate.CancelCallback
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
- 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
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @function external:jQuery.fn.jGraduate
|
|
|
|
* @param {module:jGraduate.Options} [options]
|
|
|
|
* @param {external:jQuery.fn.jGraduate.OkCallback} [okCallback] Called with a Paint object when Ok is pressed
|
|
|
|
* @param {external:jQuery.fn.jGraduate.CancelCallback} [cancelCallback] Called with no arguments when Cancel is pressed
|
|
|
|
* @returns {external:jQuery}
|
|
|
|
*/
|
|
|
|
$.fn.jGraduate = function (options, okCallback, cancelCallback) {
|
2018-05-18 06:23:36 +00:00
|
|
|
return this.each(function () {
|
2018-05-18 03:25:45 +00:00
|
|
|
const $this = $(this),
|
- 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
|
|
|
$settings = $.extend(true, {}, $.fn.jGraduateDefaults, options || {}),
|
2018-05-18 06:23:36 +00:00
|
|
|
id = $this.attr('id'),
|
|
|
|
idref = '#' + $this.attr('id') + ' ';
|
|
|
|
|
|
|
|
if (!idref) {
|
2018-11-08 06:48:01 +00:00
|
|
|
/* await */ $.alert('Container element must have an id attribute to maintain unique id strings for sub-elements.');
|
2018-05-18 06:23:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const okClicked = function () {
|
2018-05-18 06:23:36 +00:00
|
|
|
switch ($this.paint.type) {
|
|
|
|
case 'radialGradient':
|
|
|
|
$this.paint.linearGradient = null;
|
|
|
|
break;
|
|
|
|
case 'linearGradient':
|
|
|
|
$this.paint.radialGradient = null;
|
|
|
|
break;
|
|
|
|
case 'solidColor':
|
|
|
|
$this.paint.radialGradient = $this.paint.linearGradient = null;
|
|
|
|
break;
|
|
|
|
}
|
2018-05-18 03:25:45 +00:00
|
|
|
typeof $this.okCallback === 'function' && $this.okCallback($this.paint);
|
2018-05-18 06:23:36 +00:00
|
|
|
$this.hide();
|
|
|
|
};
|
2018-05-18 03:25:45 +00:00
|
|
|
const cancelClicked = function () {
|
|
|
|
typeof $this.cancelCallback === 'function' && $this.cancelCallback();
|
2018-05-18 06:23:36 +00:00
|
|
|
$this.hide();
|
|
|
|
};
|
|
|
|
|
2019-06-27 04:21:55 +00:00
|
|
|
$.extend(
|
|
|
|
true,
|
|
|
|
$this,
|
|
|
|
// public properties, methods, and callbacks
|
|
|
|
{
|
|
|
|
// make a copy of the incoming paint
|
|
|
|
paint: new $.jGraduate.Paint({copy: $settings.paint}),
|
|
|
|
okCallback: typeof okCallback === 'function' ? okCallback : null,
|
|
|
|
cancelCallback: typeof cancelCallback === 'function' ? cancelCallback : null
|
|
|
|
}
|
|
|
|
);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let // pos = $this.position(),
|
2018-05-18 06:23:36 +00:00
|
|
|
color = null;
|
2018-05-18 03:25:45 +00:00
|
|
|
const $win = $(window);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
if ($this.paint.type === 'none') {
|
- 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
|
|
|
$this.paint = new $.jGraduate.Paint({solidColor: 'ffffff'});
|
2018-05-18 06:23:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this.addClass('jGraduate_Picker');
|
2018-05-18 03:25:45 +00:00
|
|
|
$this.html(
|
|
|
|
'<ul class="jGraduate_tabs">' +
|
|
|
|
'<li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li>' +
|
|
|
|
'<li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li>' +
|
|
|
|
'<li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li>' +
|
|
|
|
'</ul>' +
|
|
|
|
'<div class="jGraduate_colPick"></div>' +
|
|
|
|
'<div class="jGraduate_gradPick"></div>' +
|
|
|
|
'<div class="jGraduate_LightBox"></div>' +
|
|
|
|
'<div id="' + id + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>'
|
2018-05-18 06:23:36 +00:00
|
|
|
);
|
2018-05-18 03:25:45 +00:00
|
|
|
const colPicker = $(idref + '> .jGraduate_colPick');
|
|
|
|
const gradPicker = $(idref + '> .jGraduate_gradPick');
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
gradPicker.html(
|
|
|
|
'<div id="' + id + '_jGraduate_Swatch" class="jGraduate_Swatch">' +
|
|
|
|
'<h2 class="jGraduate_Title">' + $settings.window.pickerTitle + '</h2>' +
|
|
|
|
'<div id="' + id + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div>' +
|
|
|
|
'<div id="' + id + '_jGraduate_StopSlider" class="jGraduate_StopSlider"></div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Form jGraduate_Points jGraduate_lg_field">' +
|
|
|
|
'<div class="jGraduate_StopSection">' +
|
|
|
|
'<label class="jGraduate_Form_Heading">Begin Point</label>' +
|
|
|
|
'<div class="jGraduate_Form_Section">' +
|
|
|
|
'<label>x:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/>' +
|
|
|
|
'<label>y:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_StopSection">' +
|
|
|
|
'<label class="jGraduate_Form_Heading">End Point</label>' +
|
|
|
|
'<div class="jGraduate_Form_Section">' +
|
|
|
|
'<label>x:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/>' +
|
|
|
|
'<label>y:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Form jGraduate_Points jGraduate_rg_field">' +
|
|
|
|
'<div class="jGraduate_StopSection">' +
|
|
|
|
'<label class="jGraduate_Form_Heading">Center Point</label>' +
|
|
|
|
'<div class="jGraduate_Form_Section">' +
|
|
|
|
'<label>x:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/>' +
|
|
|
|
'<label>y:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_StopSection">' +
|
|
|
|
'<label class="jGraduate_Form_Heading">Focal Point</label>' +
|
|
|
|
'<div class="jGraduate_Form_Section">' +
|
|
|
|
'<label>Match center: <input type="checkbox" checked="checked" id="' + id + '_jGraduate_match_ctr"/></label><br/>' +
|
|
|
|
'<label>x:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/>' +
|
|
|
|
'<label>y:</label>' +
|
|
|
|
'<input type="text" id="' + id + '_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_StopSection jGraduate_SpreadMethod">' +
|
|
|
|
'<label class="jGraduate_Form_Heading">Spread method</label>' +
|
|
|
|
'<div class="jGraduate_Form_Section">' +
|
|
|
|
'<select class="jGraduate_spreadMethod">' +
|
|
|
|
'<option value=pad selected>Pad</option>' +
|
|
|
|
'<option value=reflect>Reflect</option>' +
|
|
|
|
'<option value=repeat>Repeat</option>' +
|
|
|
|
'</select>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Form">' +
|
|
|
|
'<div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field">' +
|
|
|
|
'<label class="prelabel">Radius:</label>' +
|
|
|
|
'<div id="' + id + '_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius">' +
|
|
|
|
'<img id="' + id + '_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="' + $settings.images.clientPath + 'rangearrows2.gif">' +
|
|
|
|
'</div>' +
|
|
|
|
'<label><input type="text" id="' + id + '_jGraduate_RadiusInput" size="3" value="100"/>%</label>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field">' +
|
|
|
|
'<label class="prelabel">Ellip:</label>' +
|
|
|
|
'<div id="' + id + '_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip">' +
|
|
|
|
'<img id="' + id + '_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="' + $settings.images.clientPath + 'rangearrows2.gif">' +
|
|
|
|
'</div>' +
|
|
|
|
'<label><input type="text" id="' + id + '_jGraduate_EllipInput" size="3" value="0"/>%</label>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field">' +
|
|
|
|
'<label class="prelabel">Angle:</label>' +
|
|
|
|
'<div id="' + id + '_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle">' +
|
|
|
|
'<img id="' + id + '_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="' + $settings.images.clientPath + 'rangearrows2.gif">' +
|
|
|
|
'</div>' +
|
|
|
|
'<label><input type="text" id="' + id + '_jGraduate_AngleInput" size="3" value="0"/>deg</label>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_Slider jGraduate_OpacField">' +
|
|
|
|
'<label class="prelabel">Opac:</label>' +
|
|
|
|
'<div id="' + id + '_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac">' +
|
|
|
|
'<img id="' + id + '_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="' + $settings.images.clientPath + 'rangearrows2.gif">' +
|
|
|
|
'</div>' +
|
|
|
|
'<label><input type="text" id="' + id + '_jGraduate_OpacInput" size="3" value="100"/>%</label>' +
|
|
|
|
'</div>' +
|
|
|
|
'</div>' +
|
|
|
|
'<div class="jGraduate_OkCancel">' +
|
|
|
|
'<input type="button" id="' + id + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/>' +
|
|
|
|
'<input type="button" id="' + id + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/>' +
|
2018-11-07 06:51:50 +00:00
|
|
|
'</div>'
|
|
|
|
);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
// --------------
|
|
|
|
// Set up all the SVG elements (the gradient, stops and rectangle)
|
2018-05-18 03:25:45 +00:00
|
|
|
const MAX = 256,
|
|
|
|
MARGINX = 0,
|
|
|
|
MARGINY = 0,
|
2018-05-18 06:23:36 +00:00
|
|
|
// STOP_RADIUS = 15 / 2,
|
2018-05-18 03:25:45 +00:00
|
|
|
SIZEX = MAX - 2 * MARGINX,
|
|
|
|
SIZEY = MAX - 2 * MARGINY;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const attrInput = {};
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const SLIDERW = 145;
|
2018-05-18 06:23:36 +00:00
|
|
|
$('.jGraduate_SliderBar').width(SLIDERW);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const container = $('#' + id + '_jGraduate_GradContainer')[0];
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const svg = mkElem('svg', {
|
2018-05-18 06:23:36 +00:00
|
|
|
id: id + '_jgraduate_svg',
|
|
|
|
width: MAX,
|
|
|
|
height: MAX,
|
|
|
|
xmlns: ns.svg
|
|
|
|
}, container);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
// This wasn't working as designed
|
|
|
|
// let curType;
|
|
|
|
// curType = curType || $this.paint.type;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
// if we are sent a gradient, import it
|
|
|
|
let curType = $this.paint.type;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let grad = $this.paint[curType];
|
|
|
|
let curGradient = grad;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const gradalpha = $this.paint.alpha;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const isSolid = curType === 'solidColor';
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
// Make any missing gradients
|
|
|
|
switch (curType) {
|
|
|
|
case 'solidColor':
|
|
|
|
// fall through
|
|
|
|
case 'linearGradient':
|
|
|
|
if (!isSolid) {
|
|
|
|
curGradient.id = id + '_lg_jgraduate_grad';
|
|
|
|
grad = curGradient = svg.appendChild(curGradient); // .cloneNode(true));
|
|
|
|
}
|
|
|
|
mkElem('radialGradient', {
|
|
|
|
id: id + '_rg_jgraduate_grad'
|
|
|
|
}, svg);
|
2018-05-18 03:25:45 +00:00
|
|
|
if (curType === 'linearGradient') { break; }
|
2018-05-18 06:23:36 +00:00
|
|
|
// fall through
|
|
|
|
case 'radialGradient':
|
|
|
|
if (!isSolid) {
|
|
|
|
curGradient.id = id + '_rg_jgraduate_grad';
|
|
|
|
grad = curGradient = svg.appendChild(curGradient); // .cloneNode(true));
|
|
|
|
}
|
|
|
|
mkElem('linearGradient', {
|
|
|
|
id: id + '_lg_jgraduate_grad'
|
|
|
|
}, svg);
|
|
|
|
}
|
|
|
|
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
let stopGroup; // eslint-disable-line prefer-const
|
2018-05-18 06:23:36 +00:00
|
|
|
if (isSolid) {
|
|
|
|
grad = curGradient = $('#' + id + '_lg_jgraduate_grad')[0];
|
2018-05-18 03:25:45 +00:00
|
|
|
color = $this.paint[curType];
|
2018-05-18 06:23:36 +00:00
|
|
|
mkStop(0, '#' + color, 1);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const type = typeof $settings.newstop;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
if (type === 'string') {
|
|
|
|
switch ($settings.newstop) {
|
|
|
|
case 'same':
|
|
|
|
mkStop(1, '#' + color, 1);
|
|
|
|
break;
|
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
case 'inverse': {
|
2018-05-18 06:23:36 +00:00
|
|
|
// Invert current color for second stop
|
2018-05-18 03:25:45 +00:00
|
|
|
let inverted = '';
|
|
|
|
for (let i = 0; i < 6; i += 2) {
|
|
|
|
// const ch = color.substr(i, 2);
|
|
|
|
let inv = (255 - parseInt(color.substr(i, 2), 16)).toString(16);
|
2018-05-18 06:23:36 +00:00
|
|
|
if (inv.length < 2) inv = 0 + inv;
|
|
|
|
inverted += inv;
|
|
|
|
}
|
|
|
|
mkStop(1, '#' + inverted, 1);
|
|
|
|
break;
|
2018-11-08 06:48:01 +00:00
|
|
|
} case 'white':
|
2018-05-18 06:23:36 +00:00
|
|
|
mkStop(1, '#ffffff', 1);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'black':
|
|
|
|
mkStop(1, '#000000', 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (type === 'object') {
|
2018-05-18 03:25:45 +00:00
|
|
|
const opac = ('opac' in $settings.newstop) ? $settings.newstop.opac : 1;
|
2018-05-18 06:23:36 +00:00
|
|
|
mkStop(1, ($settings.newstop.color || '#' + color), opac);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const x1 = parseFloat(grad.getAttribute('x1') || 0.0),
|
2018-05-18 06:23:36 +00:00
|
|
|
y1 = parseFloat(grad.getAttribute('y1') || 0.0),
|
|
|
|
x2 = parseFloat(grad.getAttribute('x2') || 1.0),
|
|
|
|
y2 = parseFloat(grad.getAttribute('y2') || 0.0);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const cx = parseFloat(grad.getAttribute('cx') || 0.5),
|
2018-05-18 06:23:36 +00:00
|
|
|
cy = parseFloat(grad.getAttribute('cy') || 0.5),
|
|
|
|
fx = parseFloat(grad.getAttribute('fx') || cx),
|
|
|
|
fy = parseFloat(grad.getAttribute('fy') || cy);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const previewRect = mkElem('rect', {
|
2018-05-18 06:23:36 +00:00
|
|
|
id: id + '_jgraduate_rect',
|
|
|
|
x: MARGINX,
|
|
|
|
y: MARGINY,
|
|
|
|
width: SIZEX,
|
|
|
|
height: SIZEY,
|
|
|
|
fill: 'url(#' + id + '_jgraduate_grad)',
|
|
|
|
'fill-opacity': gradalpha / 100
|
|
|
|
}, svg);
|
|
|
|
|
|
|
|
// stop visuals created here
|
2018-05-18 03:25:45 +00:00
|
|
|
const beginCoord = $('<div/>').attr({
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
class: 'grad_coord jGraduate_lg_field',
|
2018-05-18 06:23:36 +00:00
|
|
|
title: 'Begin Stop'
|
|
|
|
}).text(1).css({
|
|
|
|
top: y1 * MAX,
|
|
|
|
left: x1 * MAX
|
|
|
|
}).data('coord', 'start').appendTo(container);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const endCoord = beginCoord.clone().text(2).css({
|
2018-05-18 06:23:36 +00:00
|
|
|
top: y2 * MAX,
|
|
|
|
left: x2 * MAX
|
|
|
|
}).attr('title', 'End stop').data('coord', 'end').appendTo(container);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const centerCoord = $('<div/>').attr({
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
class: 'grad_coord jGraduate_rg_field',
|
2018-05-18 06:23:36 +00:00
|
|
|
title: 'Center stop'
|
|
|
|
}).text('C').css({
|
|
|
|
top: cy * MAX,
|
|
|
|
left: cx * MAX
|
|
|
|
}).data('coord', 'center').appendTo(container);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const focusCoord = centerCoord.clone().text('F').css({
|
2018-05-18 06:23:36 +00:00
|
|
|
top: fy * MAX,
|
|
|
|
left: fx * MAX,
|
|
|
|
display: 'none'
|
|
|
|
}).attr('title', 'Focus point').data('coord', 'focus').appendTo(container);
|
|
|
|
|
|
|
|
focusCoord[0].id = id + '_jGraduate_focusCoord';
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
// const coords = $(idref + ' .grad_coord');
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
// $(container).hover(function () {
|
|
|
|
// coords.animate({
|
|
|
|
// opacity: 1
|
|
|
|
// }, 500);
|
|
|
|
// }, function () {
|
|
|
|
// coords.animate({
|
|
|
|
// opacity: .2
|
|
|
|
// }, 500);
|
|
|
|
// });
|
|
|
|
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
let showFocus;
|
2018-05-18 06:23:36 +00:00
|
|
|
$.each(['x1', 'y1', 'x2', 'y2', 'cx', 'cy', 'fx', 'fy'], function (i, attr) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const isRadial = isNaN(attr[1]);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let attrval = curGradient.getAttribute(attr);
|
2018-05-18 06:23:36 +00:00
|
|
|
if (!attrval) {
|
|
|
|
// Set defaults
|
|
|
|
if (isRadial) {
|
|
|
|
// For radial points
|
|
|
|
attrval = '0.5';
|
|
|
|
} else {
|
|
|
|
// Only x2 is 1
|
|
|
|
attrval = attr === 'x2' ? '1.0' : '0.0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
attrInput[attr] = $('#' + id + '_jGraduate_' + attr)
|
|
|
|
.val(attrval)
|
|
|
|
.change(function () {
|
|
|
|
// TODO: Support values < 0 and > 1 (zoomable preview?)
|
|
|
|
if (isNaN(parseFloat(this.value)) || this.value < 0) {
|
|
|
|
this.value = 0.0;
|
|
|
|
} else if (this.value > 1) {
|
|
|
|
this.value = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(attr[0] === 'f' && !showFocus)) {
|
|
|
|
if ((isRadial && curType === 'radialGradient') || (!isRadial && curType === 'linearGradient')) {
|
|
|
|
curGradient.setAttribute(attr, this.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const $elem = isRadial
|
|
|
|
? attr[0] === 'c' ? centerCoord : focusCoord
|
|
|
|
: attr[1] === '1' ? beginCoord : endCoord;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const cssName = attr.includes('x') ? 'left' : 'top';
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
$elem.css(cssName, this.value * MAX);
|
|
|
|
}).change();
|
|
|
|
});
|
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {Float} n
|
|
|
|
* @param {Float|string} colr
|
|
|
|
* @param {Float} opac
|
|
|
|
* @param {boolean} [sel]
|
|
|
|
* @param {SVGStopElement} [stopElem]
|
|
|
|
* @returns {SVGStopElement}
|
|
|
|
*/
|
|
|
|
function mkStop (n, colr, opac, sel, stopElem) {
|
|
|
|
const stop = stopElem || mkElem('stop', {
|
|
|
|
'stop-color': colr,
|
|
|
|
'stop-opacity': opac,
|
|
|
|
offset: n
|
|
|
|
}, curGradient);
|
2018-05-18 06:23:36 +00:00
|
|
|
if (stopElem) {
|
2018-11-08 06:48:01 +00:00
|
|
|
colr = stopElem.getAttribute('stop-color');
|
2018-05-18 06:23:36 +00:00
|
|
|
opac = stopElem.getAttribute('stop-opacity');
|
|
|
|
n = stopElem.getAttribute('offset');
|
|
|
|
} else {
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
curGradient.append(stop);
|
2018-05-18 06:23:36 +00:00
|
|
|
}
|
|
|
|
if (opac === null) opac = 1;
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const pickerD = 'M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z';
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const pathbg = mkElem('path', {
|
2018-05-18 06:23:36 +00:00
|
|
|
d: pickerD,
|
|
|
|
fill: 'url(#jGraduate_trans)',
|
|
|
|
transform: 'translate(' + (10 + n * MAX) + ', 26)'
|
|
|
|
}, stopGroup);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const path = mkElem('path', {
|
2018-05-18 06:23:36 +00:00
|
|
|
d: pickerD,
|
2018-11-08 06:48:01 +00:00
|
|
|
fill: colr,
|
2018-05-18 06:23:36 +00:00
|
|
|
'fill-opacity': opac,
|
|
|
|
transform: 'translate(' + (10 + n * MAX) + ', 26)',
|
|
|
|
stroke: '#000',
|
|
|
|
'stroke-width': 1.5
|
|
|
|
}, stopGroup);
|
|
|
|
|
|
|
|
$(path).mousedown(function (e) {
|
|
|
|
selectStop(this);
|
|
|
|
drag = curStop;
|
|
|
|
$win.mousemove(dragColor).mouseup(remDrags);
|
|
|
|
stopOffset = stopMakerDiv.offset();
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
}).data('stop', stop).data('bg', pathbg).dblclick(function () {
|
|
|
|
$('div.jGraduate_LightBox').show();
|
2018-11-08 06:48:01 +00:00
|
|
|
const colorhandle = this; // eslint-disable-line consistent-this
|
|
|
|
let stopOpacity = Number(stop.getAttribute('stop-opacity')) || 1;
|
2018-05-18 03:25:45 +00:00
|
|
|
let stopColor = stop.getAttribute('stop-color') || 1;
|
|
|
|
let thisAlpha = (parseFloat(stopOpacity) * 255).toString(16);
|
2018-05-18 06:23:36 +00:00
|
|
|
while (thisAlpha.length < 2) { thisAlpha = '0' + thisAlpha; }
|
2018-11-08 06:48:01 +00:00
|
|
|
colr = stopColor.substr(1) + thisAlpha;
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
$('#' + id + '_jGraduate_stopPicker').css({left: 100, bottom: 15}).jPicker({
|
2018-09-07 00:18:37 +00:00
|
|
|
window: {title: 'Pick the start color and opacity for the gradient'},
|
|
|
|
images: {clientPath: $settings.images.clientPath},
|
2018-11-08 06:48:01 +00:00
|
|
|
color: {active: colr, alphaSupport: true}
|
|
|
|
}, function (clr, arg2) {
|
|
|
|
stopColor = clr.val('hex') ? ('#' + clr.val('hex')) : 'none';
|
|
|
|
stopOpacity = clr.val('a') !== null ? clr.val('a') / 256 : 1;
|
2018-05-18 06:23:36 +00:00
|
|
|
colorhandle.setAttribute('fill', stopColor);
|
|
|
|
colorhandle.setAttribute('fill-opacity', stopOpacity);
|
|
|
|
stop.setAttribute('stop-color', stopColor);
|
|
|
|
stop.setAttribute('stop-opacity', stopOpacity);
|
|
|
|
$('div.jGraduate_LightBox').hide();
|
|
|
|
$('#' + id + '_jGraduate_stopPicker').hide();
|
|
|
|
}, null, function () {
|
|
|
|
$('div.jGraduate_LightBox').hide();
|
|
|
|
$('#' + id + '_jGraduate_stopPicker').hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(curGradient).find('stop').each(function () {
|
2018-05-18 03:25:45 +00:00
|
|
|
const curS = $(this);
|
2018-11-08 06:48:01 +00:00
|
|
|
if (Number(this.getAttribute('offset')) > n) {
|
|
|
|
if (!colr) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const newcolor = this.getAttribute('stop-color');
|
|
|
|
const newopac = this.getAttribute('stop-opacity');
|
2018-05-18 06:23:36 +00:00
|
|
|
stop.setAttribute('stop-color', newcolor);
|
|
|
|
path.setAttribute('fill', newcolor);
|
|
|
|
stop.setAttribute('stop-opacity', newopac === null ? 1 : newopac);
|
|
|
|
path.setAttribute('fill-opacity', newopac === null ? 1 : newopac);
|
|
|
|
}
|
|
|
|
curS.before(stop);
|
|
|
|
return false;
|
|
|
|
}
|
2018-11-08 06:48:01 +00:00
|
|
|
return true;
|
2018-05-18 06:23:36 +00:00
|
|
|
});
|
|
|
|
if (sel) selectStop(path);
|
|
|
|
return stop;
|
|
|
|
}
|
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
*
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
function remStop () {
|
|
|
|
delStop.setAttribute('display', 'none');
|
2018-05-18 03:25:45 +00:00
|
|
|
const path = $(curStop);
|
|
|
|
const stop = path.data('stop');
|
|
|
|
const bg = path.data('bg');
|
2018-05-18 06:23:36 +00:00
|
|
|
$([curStop, stop, bg]).remove();
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const stopMakerDiv = $('#' + id + '_jGraduate_StopSlider');
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let stops, curStop, drag;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const delStop = mkElem('path', {
|
2018-05-18 06:23:36 +00:00
|
|
|
d: 'm9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5',
|
|
|
|
fill: 'none',
|
|
|
|
stroke: '#D00',
|
|
|
|
'stroke-width': 5,
|
|
|
|
display: 'none'
|
2018-05-18 03:25:45 +00:00
|
|
|
}, undefined); // stopMakerSVG);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
* @param {Element} item
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
function selectStop (item) {
|
|
|
|
if (curStop) curStop.setAttribute('stroke', '#000');
|
|
|
|
item.setAttribute('stroke', 'blue');
|
|
|
|
curStop = item;
|
|
|
|
// stops = $('stop');
|
|
|
|
// opac_select.val(curStop.attr('fill-opacity') || 1);
|
|
|
|
// root.append(delStop);
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let stopOffset;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
*
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
function remDrags () {
|
|
|
|
$win.unbind('mousemove', dragColor);
|
|
|
|
if (delStop.getAttribute('display') !== 'none') {
|
|
|
|
remStop();
|
|
|
|
}
|
|
|
|
drag = null;
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let scaleX = 1, scaleY = 1, angle = 0;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let cX = cx;
|
|
|
|
let cY = cy;
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
*
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
function xform () {
|
2018-05-18 03:25:45 +00:00
|
|
|
const rot = angle ? 'rotate(' + angle + ',' + cX + ',' + cY + ') ' : '';
|
2018-05-18 06:23:36 +00:00
|
|
|
if (scaleX === 1 && scaleY === 1) {
|
|
|
|
curGradient.removeAttribute('gradientTransform');
|
|
|
|
// $('#ang').addClass('dis');
|
|
|
|
} else {
|
2018-05-18 03:25:45 +00:00
|
|
|
const x = -cX * (scaleX - 1);
|
|
|
|
const y = -cY * (scaleY - 1);
|
2018-05-18 06:23:36 +00:00
|
|
|
curGradient.setAttribute('gradientTransform', rot + 'translate(' + x + ',' + y + ') scale(' + scaleX + ',' + scaleY + ')');
|
|
|
|
// $('#ang').removeClass('dis');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-08 06:48:01 +00:00
|
|
|
/**
|
|
|
|
* @param {Event} evt
|
2019-04-16 00:59:16 +00:00
|
|
|
* @returns {void}
|
2018-11-08 06:48:01 +00:00
|
|
|
*/
|
2018-05-18 06:23:36 +00:00
|
|
|
function dragColor (evt) {
|
2018-05-18 03:25:45 +00:00
|
|
|
let x = evt.pageX - stopOffset.left;
|
|
|
|
const y = evt.pageY - stopOffset.top;
|
|
|
|
x = x < 10
|
|
|
|
? 10
|
|
|
|
: x > MAX + 10
|
|
|
|
? MAX + 10
|
|
|
|
: x;
|
|
|
|
|
|
|
|
const xfStr = 'translate(' + x + ', 26)';
|
2018-05-18 06:23:36 +00:00
|
|
|
if (y < -60 || y > 130) {
|
|
|
|
delStop.setAttribute('display', 'block');
|
|
|
|
delStop.setAttribute('transform', xfStr);
|
|
|
|
} else {
|
|
|
|
delStop.setAttribute('display', 'none');
|
|
|
|
}
|
|
|
|
|
|
|
|
drag.setAttribute('transform', xfStr);
|
|
|
|
$.data(drag, 'bg').setAttribute('transform', xfStr);
|
2018-05-18 03:25:45 +00:00
|
|
|
const stop = $.data(drag, 'stop');
|
|
|
|
const sX = (x - 10) / MAX;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
stop.setAttribute('offset', sX);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let last = 0;
|
2018-05-18 06:23:36 +00:00
|
|
|
$(curGradient).find('stop').each(function (i) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const cur = this.getAttribute('offset');
|
|
|
|
const t = $(this);
|
2018-05-18 06:23:36 +00:00
|
|
|
if (cur < last) {
|
|
|
|
t.prev().before(t);
|
|
|
|
stops = $(curGradient).find('stop');
|
|
|
|
}
|
|
|
|
last = cur;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const stopMakerSVG = mkElem('svg', {
|
2018-05-18 06:23:36 +00:00
|
|
|
width: '100%',
|
|
|
|
height: 45
|
|
|
|
}, stopMakerDiv[0]);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const transPattern = mkElem('pattern', {
|
2018-05-18 06:23:36 +00:00
|
|
|
width: 16,
|
|
|
|
height: 16,
|
|
|
|
patternUnits: 'userSpaceOnUse',
|
|
|
|
id: 'jGraduate_trans'
|
|
|
|
}, stopMakerSVG);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const transImg = mkElem('image', {
|
2018-05-18 06:23:36 +00:00
|
|
|
width: 16,
|
|
|
|
height: 16
|
|
|
|
}, transPattern);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const bgImage = $settings.images.clientPath + 'map-opacity.png';
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
transImg.setAttributeNS(ns.xlink, 'xlink:href', bgImage);
|
|
|
|
|
|
|
|
$(stopMakerSVG).click(function (evt) {
|
|
|
|
stopOffset = stopMakerDiv.offset();
|
2018-05-18 03:25:45 +00:00
|
|
|
const {target} = evt;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (target.tagName === 'path') return;
|
2018-05-18 03:25:45 +00:00
|
|
|
let x = evt.pageX - stopOffset.left - 8;
|
2018-05-18 06:23:36 +00:00
|
|
|
x = x < 10 ? 10 : x > MAX + 10 ? MAX + 10 : x;
|
|
|
|
mkStop(x / MAX, 0, 0, true);
|
|
|
|
evt.stopPropagation();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(stopMakerSVG).mouseover(function () {
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
stopMakerSVG.append(delStop);
|
2018-05-18 06:23:36 +00:00
|
|
|
});
|
|
|
|
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
stopGroup = mkElem('g', {}, stopMakerSVG);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
mkElem('line', {
|
|
|
|
x1: 10,
|
|
|
|
y1: 15,
|
|
|
|
x2: MAX + 10,
|
|
|
|
y2: 15,
|
|
|
|
'stroke-width': 2,
|
|
|
|
stroke: '#000'
|
|
|
|
}, stopMakerSVG);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const spreadMethodOpt = gradPicker.find('.jGraduate_spreadMethod').change(function () {
|
2018-05-18 06:23:36 +00:00
|
|
|
curGradient.setAttribute('spreadMethod', $(this).val());
|
|
|
|
});
|
|
|
|
|
|
|
|
// handle dragging the stop around the swatch
|
2018-05-18 03:25:45 +00:00
|
|
|
let draggingCoord = null;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const onCoordDrag = function (evt) {
|
|
|
|
let x = evt.pageX - offset.left;
|
|
|
|
let y = evt.pageY - offset.top;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
// clamp stop to the swatch
|
|
|
|
x = x < 0 ? 0 : x > MAX ? MAX : x;
|
|
|
|
y = y < 0 ? 0 : y > MAX ? MAX : y;
|
|
|
|
|
|
|
|
draggingCoord.css('left', x).css('top', y);
|
|
|
|
|
|
|
|
// calculate stop offset
|
2018-05-18 03:25:45 +00:00
|
|
|
const fracx = x / SIZEX;
|
|
|
|
const fracy = y / SIZEY;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const type = draggingCoord.data('coord');
|
2018-11-08 06:48:01 +00:00
|
|
|
const grd = curGradient;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case 'start':
|
|
|
|
attrInput.x1.val(fracx);
|
|
|
|
attrInput.y1.val(fracy);
|
2018-11-08 06:48:01 +00:00
|
|
|
grd.setAttribute('x1', fracx);
|
|
|
|
grd.setAttribute('y1', fracy);
|
2018-05-18 06:23:36 +00:00
|
|
|
break;
|
|
|
|
case 'end':
|
|
|
|
attrInput.x2.val(fracx);
|
|
|
|
attrInput.y2.val(fracy);
|
2018-11-08 06:48:01 +00:00
|
|
|
grd.setAttribute('x2', fracx);
|
|
|
|
grd.setAttribute('y2', fracy);
|
2018-05-18 06:23:36 +00:00
|
|
|
break;
|
|
|
|
case 'center':
|
|
|
|
attrInput.cx.val(fracx);
|
|
|
|
attrInput.cy.val(fracy);
|
2018-11-08 06:48:01 +00:00
|
|
|
grd.setAttribute('cx', fracx);
|
|
|
|
grd.setAttribute('cy', fracy);
|
2018-05-18 06:23:36 +00:00
|
|
|
cX = fracx;
|
|
|
|
cY = fracy;
|
|
|
|
xform();
|
|
|
|
break;
|
|
|
|
case 'focus':
|
|
|
|
attrInput.fx.val(fracx);
|
|
|
|
attrInput.fy.val(fracy);
|
2018-11-08 06:48:01 +00:00
|
|
|
grd.setAttribute('fx', fracx);
|
|
|
|
grd.setAttribute('fy', fracy);
|
2018-05-18 06:23:36 +00:00
|
|
|
xform();
|
|
|
|
}
|
|
|
|
|
|
|
|
evt.preventDefault();
|
|
|
|
};
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const onCoordUp = function () {
|
2018-05-18 06:23:36 +00:00
|
|
|
draggingCoord = null;
|
|
|
|
$win.unbind('mousemove', onCoordDrag).unbind('mouseup', onCoordUp);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Linear gradient
|
|
|
|
// (function () {
|
|
|
|
|
|
|
|
stops = curGradient.getElementsByTagNameNS(ns.svg, 'stop');
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let numstops = stops.length;
|
2018-05-18 06:23:36 +00:00
|
|
|
// if there are not at least two stops, then
|
|
|
|
if (numstops < 2) {
|
|
|
|
while (numstops < 2) {
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
curGradient.append(document.createElementNS(ns.svg, 'stop'));
|
2018-05-18 06:23:36 +00:00
|
|
|
++numstops;
|
|
|
|
}
|
|
|
|
stops = curGradient.getElementsByTagNameNS(ns.svg, 'stop');
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
for (let i = 0; i < numstops; i++) {
|
2018-05-18 06:23:36 +00:00
|
|
|
mkStop(0, 0, 0, 0, stops[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
spreadMethodOpt.val(curGradient.getAttribute('spreadMethod') || 'pad');
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let offset;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
// No match, so show focus point
|
- Breaking change: Rename config file to `svgedit-config-iife.js` (or for the module version, `svgedit-config-es.js`);
also expect one directory higher; incorporates #207 (@iuyiuy)
- Breaking change: Separate `extIconsPath` from `extPath` (not copying over icons)
- Breaking change: Don't reference `custom.css` in HTML; can instead be referenced in JavaScript through
the config file (provided in `svgedit-config-sample-iife.js`/`svgedit-config-sample-es.js` as `svgedit-custom.css` for
better namespacing); incorporates #207 (@iuyiuy)
- Breaking change: Remove minified jgraduate/spinbtn files (minified within Rollup routine)
- Fix: Zoom when scrolled; incorporates #169 (@AndrolGenhald), adapting for conventions; also allow avoidance when shift key pressed
- Fix: Update Atom feed reference in HTML
- Fixes related to recent commits: Some path and method name fixes needed, function order, missing methods, variable scope declaration, no need for DOMContentLoaded listeners in modules, switch back to non-default export, avoid trimming nullish, deal with mock tests, fix `math.matrixMultiply`, use jquery-svg where needed for array/SVG attributes; add babel-polyfill and defer script to imagelib; other misc. fixes
- Enhancement: Move config-sample.js out of `editor` directory
- Enhancement: For `callback`-style extensions, also provide config object; add following
to that object: buildCanvgCallback, canvg, decode64, encode64, executeAfterLoads, getTypeMap, isChrome, ieIE, NS, text2xml
- Enhancement: Complete ES6 modules work (extensions, locales, tests), along with Babel;
make Node build routine for converting modular source to non-modular,
use `loadStylesheets` for modular stylehsheet defining (but parallel loading);
- Enhancement: Add `stylesheets` config for modular but parallel stylesheet loading with `@default` option for simple inclusion/exclusion of defaults (if not going with default).
- Refactoring: Clean up `svg-editor.html`: consistent indents; avoid extra lbs, avoid long lines
- Refactoring: Avoid embedded API adding inline JavaScript listener
- Refactoring: Move layers and context code to `draw.js`
- Refactoring: Move `pathActions` from `svgcanvas.js` (though preserve aliases to these methods on `canvas`) and `convertPath` from `svgutils.js` to `path.js`
- Refactoring: Move `getStrokedBBox` from `svgcanvas.js` (while keeping an alias) to `svgutils.js` (as `getStrokedBBoxDefaultVisible` to avoid conflict with existing)
- Docs: Remove "dependencies" comments in code except where summarizing role of jQuery or a non-obvious dependency
- Refactoring/Linting: Enfore `no-extra-semi` and `quote-props` rules
- Refactoring: Further avoidance of quotes on properties (as possible)
- Refactoring: Use `class` in place of functions where intended as classes
- Refactoring: Consistency and granularity in extensions imports
- Testing: Update QUnit to 2.6.1 (node_modules) and Sinon to 5.0.8 (and add sinon-test at 2.1.3) and enforce eslint-plugin-qunit linting rules; update custom extensions
- Testing: Add node-static for automating (and accessing out-of-directory contents)
- Testing: Avoid HTML attributes for styling
- Testing: Add npm `test` script
- Testing: Comment out unused jQuery SVG test
- Testing: Add test1 and svgutils_performance_test to all tests page
- Testing: Due apparently to Path having not been a formal class, the test was calling it without `new`; refactored now with sufficient mock data to take into account it is a class
- npm: Update devDeps
- npm: Add html modules and config build to test script
2018-05-22 10:03:16 +00:00
|
|
|
showFocus = false;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
previewRect.setAttribute('fill-opacity', gradalpha / 100);
|
|
|
|
|
|
|
|
$('#' + id + ' div.grad_coord').mousedown(function (evt) {
|
|
|
|
evt.preventDefault();
|
|
|
|
draggingCoord = $(this);
|
2018-05-18 03:25:45 +00:00
|
|
|
// const sPos = draggingCoord.offset();
|
2018-05-18 06:23:36 +00:00
|
|
|
offset = draggingCoord.parent().offset();
|
|
|
|
$win.mousemove(onCoordDrag).mouseup(onCoordUp);
|
|
|
|
});
|
|
|
|
|
|
|
|
// bind GUI elements
|
|
|
|
$('#' + id + '_jGraduate_Ok').bind('click', function () {
|
|
|
|
$this.paint.type = curType;
|
|
|
|
$this.paint[curType] = curGradient.cloneNode(true);
|
|
|
|
$this.paint.solidColor = null;
|
|
|
|
okClicked();
|
|
|
|
});
|
|
|
|
$('#' + id + '_jGraduate_Cancel').bind('click', function (paint) {
|
|
|
|
cancelClicked();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (curType === 'radialGradient') {
|
|
|
|
if (showFocus) {
|
|
|
|
focusCoord.show();
|
|
|
|
} else {
|
|
|
|
focusCoord.hide();
|
|
|
|
attrInput.fx.val('');
|
|
|
|
attrInput.fy.val('');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#' + id + '_jGraduate_match_ctr')[0].checked = !showFocus;
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let lastfx, lastfy;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
$('#' + id + '_jGraduate_match_ctr').change(function () {
|
|
|
|
showFocus = !this.checked;
|
|
|
|
focusCoord.toggle(showFocus);
|
|
|
|
attrInput.fx.val('');
|
|
|
|
attrInput.fy.val('');
|
2018-11-08 06:48:01 +00:00
|
|
|
const grd = curGradient;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (!showFocus) {
|
2018-11-08 06:48:01 +00:00
|
|
|
lastfx = grd.getAttribute('fx');
|
|
|
|
lastfy = grd.getAttribute('fy');
|
|
|
|
grd.removeAttribute('fx');
|
|
|
|
grd.removeAttribute('fy');
|
2018-05-18 06:23:36 +00:00
|
|
|
} else {
|
2018-11-08 06:48:01 +00:00
|
|
|
const fX = lastfx || 0.5;
|
|
|
|
const fY = lastfy || 0.5;
|
|
|
|
grd.setAttribute('fx', fX);
|
|
|
|
grd.setAttribute('fy', fY);
|
|
|
|
attrInput.fx.val(fX);
|
|
|
|
attrInput.fy.val(fY);
|
2018-05-18 06:23:36 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
stops = curGradient.getElementsByTagNameNS(ns.svg, 'stop');
|
|
|
|
numstops = stops.length;
|
2018-05-18 06:23:36 +00:00
|
|
|
// if there are not at least two stops, then
|
|
|
|
if (numstops < 2) {
|
|
|
|
while (numstops < 2) {
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
curGradient.append(document.createElementNS(ns.svg, 'stop'));
|
2018-05-18 06:23:36 +00:00
|
|
|
++numstops;
|
|
|
|
}
|
|
|
|
stops = curGradient.getElementsByTagNameNS(ns.svg, 'stop');
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let slider;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const setSlider = function (e) {
|
2018-11-08 06:48:01 +00:00
|
|
|
const {offset: {left}} = slider;
|
2018-05-18 03:25:45 +00:00
|
|
|
const div = slider.parent;
|
2018-11-08 06:48:01 +00:00
|
|
|
let x = (e.pageX - left - parseInt(div.css('border-left-width')));
|
2018-05-18 06:23:36 +00:00
|
|
|
if (x > SLIDERW) x = SLIDERW;
|
|
|
|
if (x <= 0) x = 0;
|
2018-05-18 03:25:45 +00:00
|
|
|
const posx = x - 5;
|
2018-05-18 06:23:36 +00:00
|
|
|
x /= SLIDERW;
|
|
|
|
|
|
|
|
switch (slider.type) {
|
|
|
|
case 'radius':
|
2018-11-21 13:03:14 +00:00
|
|
|
x = (x * 2) ** 2.5;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (x > 0.98 && x < 1.02) x = 1;
|
|
|
|
if (x <= 0.01) x = 0.01;
|
|
|
|
curGradient.setAttribute('r', x);
|
|
|
|
break;
|
|
|
|
case 'opacity':
|
|
|
|
$this.paint.alpha = parseInt(x * 100);
|
|
|
|
previewRect.setAttribute('fill-opacity', x);
|
|
|
|
break;
|
|
|
|
case 'ellip':
|
|
|
|
scaleX = 1;
|
|
|
|
scaleY = 1;
|
|
|
|
if (x < 0.5) {
|
|
|
|
x /= 0.5; // 0.001
|
|
|
|
scaleX = x <= 0 ? 0.01 : x;
|
|
|
|
} else if (x > 0.5) {
|
|
|
|
x /= 0.5; // 2
|
|
|
|
x = 2 - x;
|
|
|
|
scaleY = x <= 0 ? 0.01 : x;
|
|
|
|
}
|
|
|
|
xform();
|
|
|
|
x -= 1;
|
|
|
|
if (scaleY === x + 1) {
|
|
|
|
x = Math.abs(x);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'angle':
|
2018-11-08 06:48:01 +00:00
|
|
|
x -= 0.5;
|
2018-05-18 06:23:36 +00:00
|
|
|
angle = x *= 180;
|
|
|
|
xform();
|
|
|
|
x /= 100;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
slider.elem.css({'margin-left': posx});
|
|
|
|
x = Math.round(x * 100);
|
|
|
|
slider.input.val(x);
|
|
|
|
};
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
let ellipVal = 0, angleVal = 0;
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
if (curType === 'radialGradient') {
|
2018-05-18 03:25:45 +00:00
|
|
|
const tlist = curGradient.gradientTransform.baseVal;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (tlist.numberOfItems === 2) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const t = tlist.getItem(0);
|
|
|
|
const s = tlist.getItem(1);
|
2018-05-18 06:23:36 +00:00
|
|
|
if (t.type === 2 && s.type === 3) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const m = s.matrix;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (m.a !== 1) {
|
|
|
|
ellipVal = Math.round(-(1 - m.a) * 100);
|
|
|
|
} else if (m.d !== 1) {
|
|
|
|
ellipVal = Math.round((1 - m.d) * 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (tlist.numberOfItems === 3) {
|
|
|
|
// Assume [R][T][S]
|
2018-05-18 03:25:45 +00:00
|
|
|
const r = tlist.getItem(0);
|
|
|
|
const t = tlist.getItem(1);
|
|
|
|
const s = tlist.getItem(2);
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
if (r.type === 4 &&
|
|
|
|
t.type === 2 &&
|
|
|
|
s.type === 3
|
|
|
|
) {
|
|
|
|
angleVal = Math.round(r.angle);
|
2018-05-18 03:25:45 +00:00
|
|
|
const m = s.matrix;
|
2018-05-18 06:23:36 +00:00
|
|
|
if (m.a !== 1) {
|
|
|
|
ellipVal = Math.round(-(1 - m.a) * 100);
|
|
|
|
} else if (m.d !== 1) {
|
|
|
|
ellipVal = Math.round((1 - m.d) * 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const sliders = {
|
2018-05-18 06:23:36 +00:00
|
|
|
radius: {
|
|
|
|
handle: '#' + id + '_jGraduate_RadiusArrows',
|
|
|
|
input: '#' + id + '_jGraduate_RadiusInput',
|
|
|
|
val: (curGradient.getAttribute('r') || 0.5) * 100
|
|
|
|
},
|
|
|
|
opacity: {
|
|
|
|
handle: '#' + id + '_jGraduate_OpacArrows',
|
|
|
|
input: '#' + id + '_jGraduate_OpacInput',
|
|
|
|
val: $this.paint.alpha || 100
|
|
|
|
},
|
|
|
|
ellip: {
|
|
|
|
handle: '#' + id + '_jGraduate_EllipArrows',
|
|
|
|
input: '#' + id + '_jGraduate_EllipInput',
|
|
|
|
val: ellipVal
|
|
|
|
},
|
|
|
|
angle: {
|
|
|
|
handle: '#' + id + '_jGraduate_AngleArrows',
|
|
|
|
input: '#' + id + '_jGraduate_AngleInput',
|
|
|
|
val: angleVal
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$.each(sliders, function (type, data) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const handle = $(data.handle);
|
2018-05-18 06:23:36 +00:00
|
|
|
handle.mousedown(function (evt) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const parent = handle.parent();
|
2018-05-18 06:23:36 +00:00
|
|
|
slider = {
|
2018-05-18 03:25:45 +00:00
|
|
|
type,
|
2018-05-18 06:23:36 +00:00
|
|
|
elem: handle,
|
|
|
|
input: $(data.input),
|
2018-05-18 03:25:45 +00:00
|
|
|
parent,
|
2018-05-18 06:23:36 +00:00
|
|
|
offset: parent.offset()
|
|
|
|
};
|
|
|
|
$win.mousemove(dragSlider).mouseup(stopSlider);
|
|
|
|
evt.preventDefault();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(data.input).val(data.val).change(function () {
|
2018-05-18 03:25:45 +00:00
|
|
|
const isRad = curType === 'radialGradient';
|
2018-11-08 06:48:01 +00:00
|
|
|
let val = Number(this.value);
|
2018-05-18 03:25:45 +00:00
|
|
|
let xpos = 0;
|
2018-05-18 06:23:36 +00:00
|
|
|
switch (type) {
|
|
|
|
case 'radius':
|
|
|
|
if (isRad) curGradient.setAttribute('r', val / 100);
|
2018-11-21 13:03:14 +00:00
|
|
|
xpos = (((val / 100) ** (1 / 2.5)) / 2) * SLIDERW;
|
2018-05-18 06:23:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'opacity':
|
|
|
|
$this.paint.alpha = val;
|
|
|
|
previewRect.setAttribute('fill-opacity', val / 100);
|
|
|
|
xpos = val * (SLIDERW / 100);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'ellip':
|
|
|
|
scaleX = scaleY = 1;
|
|
|
|
if (val === 0) {
|
|
|
|
xpos = SLIDERW * 0.5;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (val > 99.5) val = 99.5;
|
|
|
|
if (val > 0) {
|
|
|
|
scaleY = 1 - (val / 100);
|
|
|
|
} else {
|
|
|
|
scaleX = -(val / 100) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
xpos = SLIDERW * ((val + 100) / 2) / 100;
|
|
|
|
if (isRad) xform();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'angle':
|
|
|
|
angle = val;
|
|
|
|
xpos = angle / 180;
|
|
|
|
xpos += 0.5;
|
|
|
|
xpos *= SLIDERW;
|
|
|
|
if (isRad) xform();
|
|
|
|
}
|
|
|
|
if (xpos > SLIDERW) {
|
|
|
|
xpos = SLIDERW;
|
|
|
|
} else if (xpos < 0) {
|
|
|
|
xpos = 0;
|
|
|
|
}
|
|
|
|
handle.css({'margin-left': xpos - 5});
|
|
|
|
}).change();
|
|
|
|
});
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const dragSlider = function (evt) {
|
2018-05-18 06:23:36 +00:00
|
|
|
setSlider(evt);
|
|
|
|
evt.preventDefault();
|
|
|
|
};
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const stopSlider = function (evt) {
|
2018-05-18 06:23:36 +00:00
|
|
|
$win.unbind('mousemove', dragSlider).unbind('mouseup', stopSlider);
|
|
|
|
slider = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
// --------------
|
2018-05-18 03:25:45 +00:00
|
|
|
let thisAlpha = ($this.paint.alpha * 255 / 100).toString(16);
|
2018-05-18 06:23:36 +00:00
|
|
|
while (thisAlpha.length < 2) { thisAlpha = '0' + thisAlpha; }
|
|
|
|
thisAlpha = thisAlpha.split('.')[0];
|
|
|
|
color = $this.paint.solidColor === 'none' ? '' : $this.paint.solidColor + thisAlpha;
|
|
|
|
|
|
|
|
if (!isSolid) {
|
|
|
|
color = stops[0].getAttribute('stop-color');
|
|
|
|
}
|
|
|
|
|
|
|
|
// This should be done somewhere else, probably
|
|
|
|
$.extend($.fn.jPicker.defaults.window, {
|
|
|
|
alphaSupport: true, effects: {type: 'show', speed: 0}
|
|
|
|
});
|
|
|
|
|
|
|
|
colPicker.jPicker(
|
|
|
|
{
|
2018-09-07 00:18:37 +00:00
|
|
|
window: {title: $settings.window.pickerTitle},
|
|
|
|
images: {clientPath: $settings.images.clientPath},
|
|
|
|
color: {active: color, alphaSupport: true}
|
2018-05-18 06:23:36 +00:00
|
|
|
},
|
2018-11-08 06:48:01 +00:00
|
|
|
function (clr) {
|
2018-05-18 06:23:36 +00:00
|
|
|
$this.paint.type = 'solidColor';
|
2018-11-08 06:48:01 +00:00
|
|
|
$this.paint.alpha = clr.val('ahex') ? Math.round((clr.val('a') / 255) * 100) : 100;
|
|
|
|
$this.paint.solidColor = clr.val('hex') ? clr.val('hex') : 'none';
|
2018-05-18 06:23:36 +00:00
|
|
|
$this.paint.radialGradient = null;
|
|
|
|
okClicked();
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
function () { cancelClicked(); }
|
|
|
|
);
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const tabs = $(idref + ' .jGraduate_tabs li');
|
2018-05-18 06:23:36 +00:00
|
|
|
tabs.click(function () {
|
|
|
|
tabs.removeClass('jGraduate_tab_current');
|
|
|
|
$(this).addClass('jGraduate_tab_current');
|
|
|
|
$(idref + ' > div').hide();
|
2018-05-18 03:25:45 +00:00
|
|
|
const type = $(this).attr('data-type');
|
|
|
|
/* const container = */ $(idref + ' .jGraduate_gradPick').show();
|
2018-05-18 06:23:36 +00:00
|
|
|
if (type === 'rg' || type === 'lg') {
|
|
|
|
// Show/hide appropriate fields
|
|
|
|
$('.jGraduate_' + type + '_field').show();
|
|
|
|
$('.jGraduate_' + (type === 'lg' ? 'rg' : 'lg') + '_field').hide();
|
|
|
|
|
|
|
|
$('#' + id + '_jgraduate_rect')[0].setAttribute('fill', 'url(#' + id + '_' + type + '_jgraduate_grad)');
|
|
|
|
|
|
|
|
// Copy stops
|
|
|
|
|
|
|
|
curType = type === 'lg' ? 'linearGradient' : 'radialGradient';
|
|
|
|
|
|
|
|
$('#' + id + '_jGraduate_OpacInput').val($this.paint.alpha).change();
|
|
|
|
|
2018-05-18 03:25:45 +00:00
|
|
|
const newGrad = $('#' + id + '_' + type + '_jgraduate_grad')[0];
|
2018-05-18 06:23:36 +00:00
|
|
|
|
|
|
|
if (curGradient !== newGrad) {
|
2018-05-18 03:25:45 +00:00
|
|
|
const curStops = $(curGradient).find('stop');
|
2018-05-18 06:23:36 +00:00
|
|
|
$(newGrad).empty().append(curStops);
|
|
|
|
curGradient = newGrad;
|
2018-05-18 03:25:45 +00:00
|
|
|
const sm = spreadMethodOpt.val();
|
2018-05-18 06:23:36 +00:00
|
|
|
curGradient.setAttribute('spreadMethod', sm);
|
|
|
|
}
|
2018-11-07 06:51:50 +00:00
|
|
|
showFocus = type === 'rg' && curGradient.getAttribute('fx') !== null && !(cx === fx && cy === fy);
|
2018-05-18 06:23:36 +00:00
|
|
|
$('#' + id + '_jGraduate_focusCoord').toggle(showFocus);
|
|
|
|
if (showFocus) {
|
|
|
|
$('#' + id + '_jGraduate_match_ctr')[0].checked = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$(idref + ' .jGraduate_gradPick').hide();
|
|
|
|
$(idref + ' .jGraduate_colPick').show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$(idref + ' > div').hide();
|
|
|
|
tabs.removeClass('jGraduate_tab_current');
|
2018-05-18 03:25:45 +00:00
|
|
|
let tab;
|
2018-05-18 06:23:36 +00:00
|
|
|
switch ($this.paint.type) {
|
|
|
|
case 'linearGradient':
|
|
|
|
tab = $(idref + ' .jGraduate_tab_lingrad');
|
|
|
|
break;
|
|
|
|
case 'radialGradient':
|
|
|
|
tab = $(idref + ' .jGraduate_tab_radgrad');
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tab = $(idref + ' .jGraduate_tab_color');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$this.show();
|
|
|
|
|
|
|
|
// jPicker will try to show after a 0ms timeout, so need to fire this after that
|
- Breaking change: Extension now formatted as export (and `this` is set to editor, including for `callback`)
- Breaking change: Locale now formatted as export
- Breaking change: Moved out remaining modular i18n (imagelib) to own folder
- Breaking change: Drop `executeAfterLoads` (and getJSPDF/getCanvg)
- Breaking change: `RGBColor` must accept `new`
- Breaking change: canvg - `stackBlurCanvasRGBA` must be set now by function (`setStackBlurCanvasRGBA`) rather than global; `canvg` now a named export
- Breaking change: Avoid passing `canvg`/`buildCanvgCallback` to extensions (have them import)
- Fix: i18nize imaglib more deeply
- Fix: Positioning of Document Properties dialog (Fixes #246)
- Fix (regression): PDF Export (Fixes #249)
- Fix (regression): Add polyfill for `ChildNode`/`ParentNode` (and use further)
- Fix (regression): Apply Babel universally to dependencies
- Fix (regression): Ordering of `uaPrefix` function in `svgEditor.js`
- Fix (regression): Embedded API
- Fix (embedded editor): Fix backspace key in Firefox so it doesn't navigate out of frame
- Fix: Alert if no exportWindow for PDF (e.g., if blocked)
- Refactoring( RGBColor) `RGBColor` as class, without rebuilding constants, optimize string replacement, move methods to prototype, use templates and object literals, use `Object.keys`
- Refactoring (canvg) Use classes more internally, use shorthand objects; array extras, return to lazy-loading
- Refactoring: Use Promises in place of `$.getScript`; always return Promises in case deciding to await resolving
- Refactoring: Avoid importing `RGBColor` into `svgutils.js` (jsPDF imports it itself)
- Refactoring: Arrow functions, destructuring, shorter property references
- Refactoring: Fix `lang` and `dir` for locales (though not in use currently anyways)
- Refactoring: Provide path config for canvg, jspdf
2018-06-02 01:14:38 +00:00
|
|
|
setTimeout(() => {
|
2018-05-18 06:23:36 +00:00
|
|
|
tab.addClass('jGraduate_tab_current').click();
|
|
|
|
}, 10);
|
|
|
|
});
|
|
|
|
};
|
2018-05-18 03:25:45 +00:00
|
|
|
return $;
|
|
|
|
}
|