- Docs (JSDoc): Further on preferring `void`
parent
894fed3e80
commit
d84f39cb3f
|
@ -5,7 +5,8 @@
|
|||
- Enhancement: Return a Promise for Editor's `setCustomHandlers`,
|
||||
`loadFromString`, `loadFromDataURI` so known when ready and set
|
||||
- Refactoring: Destructuring, templates, label Unicode code point
|
||||
- Linting (JSDoc): Update per newly enforced `require-returns`
|
||||
- Linting (JSDoc): Update per newly enforced `require-returns`; avoid
|
||||
Closure syntax
|
||||
- Docs (Refactoring): Formally specify `Promise` resolve type;
|
||||
add `typedef` for dialog result object; add an
|
||||
`ArbitraryCallbackResult` type; prefer `void`
|
||||
|
|
|
@ -278,7 +278,7 @@ export const supportsNativeTransformLists = () => supportsNativeSVGTransformList
|
|||
/**
|
||||
* Set `supportsNativeSVGTransformLists_` to `false` (for unit testing).
|
||||
* @function module:browser.disableSupportsNativeTransformLists
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const disableSupportsNativeTransformLists = () => {
|
||||
supportsNativeSVGTransformLists_ = false;
|
||||
|
|
|
@ -2599,7 +2599,7 @@ function build (opts) {
|
|||
* @param {Float} width
|
||||
* @param {Float} height
|
||||
* @param {Integer} rgba
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function imGet (img, x, y, width, height, rgba) {
|
||||
return img[y * width * 4 + x * 4 + rgba];
|
||||
|
@ -2613,7 +2613,7 @@ function build (opts) {
|
|||
* @param {Float} height
|
||||
* @param {Integer} rgba
|
||||
* @param {Float} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function imSet (img, x, y, width, height, rgba, val) {
|
||||
img[y * width * 4 + x * 4 + rgba] = val;
|
||||
|
|
|
@ -37,7 +37,7 @@ const menuItemIsValid = function (menuItem) {
|
|||
* @function module:contextmenu.add
|
||||
* @param {module:contextmenu.MenuItem} menuItem
|
||||
* @throws {Error|TypeError}
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const add = function (menuItem) {
|
||||
// menuItem: {id, label, shortcut, action}
|
||||
|
@ -73,7 +73,7 @@ export const getCustomHandler = function (handlerKey) {
|
|||
|
||||
/**
|
||||
* @param {module:contextmenu.MenuItem} menuItem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const injectExtendedContextMenuItemIntoDom = function (menuItem) {
|
||||
if (!Object.keys(contextMenuExtensions).length) {
|
||||
|
@ -89,7 +89,7 @@ const injectExtendedContextMenuItemIntoDom = function (menuItem) {
|
|||
|
||||
/**
|
||||
* @function module:contextmenu.injectExtendedContextMenuItemsIntoDom
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const injectExtendedContextMenuItemsIntoDom = function () {
|
||||
Object.values(contextMenuExtensions).forEach((menuItem) => {
|
||||
|
@ -98,6 +98,6 @@ export const injectExtendedContextMenuItemsIntoDom = function () {
|
|||
};
|
||||
/**
|
||||
* @function module:contextmenu.resetCustomMenus
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const resetCustomMenus = function () { contextMenuExtensions = {}; };
|
||||
|
|
|
@ -180,7 +180,7 @@ function jQueryContextMenu ($) {
|
|||
/**
|
||||
* Disable context menu items on the fly.
|
||||
* @memberof external:jQuery.fn
|
||||
* @param {undefined|string} o Comma-separated
|
||||
* @param {void|string} o Comma-separated
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
disableContextMenuItems (o) {
|
||||
|
@ -203,7 +203,7 @@ function jQueryContextMenu ($) {
|
|||
/**
|
||||
* Enable context menu items on the fly.
|
||||
* @memberof external:jQuery.fn
|
||||
* @param {undefined|string} o Comma-separated
|
||||
* @param {void|string} o Comma-separated
|
||||
* @returns {external:jQuery}
|
||||
*/
|
||||
enableContextMenuItems (o) {
|
||||
|
|
|
@ -43,7 +43,7 @@ let editorContext_ = null;
|
|||
/**
|
||||
* @function module:coords.init
|
||||
* @param {module:coords.EditorContext} editorContext
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (editorContext) {
|
||||
editorContext_ = editorContext;
|
||||
|
|
|
@ -52,7 +52,7 @@ export default function jQueryPluginDBox ($, strings = {ok: 'Ok', cancel: 'Cance
|
|||
/**
|
||||
* Triggered upon a change of value for the select pull-down.
|
||||
* @callback module:jQueryPluginDBox.SelectChangeListener
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* Creates a dialog of the specified type with a given message
|
||||
|
|
|
@ -175,7 +175,7 @@ export class Drawing {
|
|||
|
||||
/**
|
||||
* @param {!(string|Integer)} n The nonce to set
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setNonce (n) {
|
||||
this.svgElem_.setAttributeNS(NS.XMLNS, 'xmlns:se', NS.SE);
|
||||
|
@ -185,7 +185,7 @@ export class Drawing {
|
|||
|
||||
/**
|
||||
* Clears any previously set nonce.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clearNonce () {
|
||||
// We deliberately leave any se:nonce attributes alone,
|
||||
|
@ -385,7 +385,7 @@ export class Drawing {
|
|||
|
||||
/**
|
||||
* @param {module:history.HistoryRecordingService} hrService
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mergeLayer (hrService) {
|
||||
const currentGroup = this.current_layer.getGroup();
|
||||
|
@ -425,7 +425,7 @@ export class Drawing {
|
|||
|
||||
/**
|
||||
* @param {module:history.HistoryRecordingService} hrService
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mergeAllLayers (hrService) {
|
||||
// Set the current layer to the last layer.
|
||||
|
@ -476,7 +476,7 @@ export class Drawing {
|
|||
/**
|
||||
* Updates layer system and sets the current layer to the
|
||||
* top-most layer (last `<g>` child of this drawing).
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
identifyLayers () {
|
||||
this.all_layers = [];
|
||||
|
@ -650,7 +650,7 @@ export class Drawing {
|
|||
* action.
|
||||
* @param {string} layerName - Name of the layer on which to set the opacity
|
||||
* @param {Float} opacity - A float value in the range 0.0-1.0
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setLayerOpacity (layerName, opacity) {
|
||||
if (typeof opacity !== 'number' || opacity < 0.0 || opacity > 1.0) {
|
||||
|
@ -680,7 +680,7 @@ export class Drawing {
|
|||
* @function module:draw.randomizeIds
|
||||
* @param {boolean} enableRandomization - flag indicating if documents should have randomized ids
|
||||
* @param {draw.Drawing} currentDrawing
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const randomizeIds = function (enableRandomization, currentDrawing) {
|
||||
randIds = enableRandomization === false
|
||||
|
@ -718,7 +718,7 @@ export const randomizeIds = function (enableRandomization, currentDrawing) {
|
|||
/**
|
||||
* @function module:draw.DrawCanvasInit#setCurrentGroup
|
||||
* @param {Element} cg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:draw.DrawCanvasInit#getSelectedElements
|
||||
|
@ -735,7 +735,7 @@ export const randomizeIds = function (enableRandomization, currentDrawing) {
|
|||
/**
|
||||
* @function module:draw.DrawCanvasInit#clearSelection
|
||||
* @param {boolean} [noCall] - When `true`, does not call the "selected" handler
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* Run the callback function associated with the given event
|
||||
|
@ -744,23 +744,23 @@ export const randomizeIds = function (enableRandomization, currentDrawing) {
|
|||
* @param {module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset} arg - Argument to pass through to the callback
|
||||
* function. If the event is "changed", a (single-item) array of `Element`s is
|
||||
* passed. If the event is "contextset", the arg is `null` or `Element`.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:draw.DrawCanvasInit#addCommandToHistory
|
||||
* @param {Command} cmd
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:draw.DrawCanvasInit#changeSVGContent
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
let canvas_;
|
||||
/**
|
||||
* @function module:draw.init
|
||||
* @param {module:draw.DrawCanvasInit} canvas
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (canvas) {
|
||||
canvas_ = canvas;
|
||||
|
@ -769,7 +769,7 @@ export const init = function (canvas) {
|
|||
/**
|
||||
* Updates layer system.
|
||||
* @function module:draw.identifyLayers
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const identifyLayers = function () {
|
||||
leaveContext();
|
||||
|
@ -784,7 +784,7 @@ export const identifyLayers = function () {
|
|||
* @param {string} name - The given name
|
||||
* @param {module:history.HistoryRecordingService} hrService
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const createLayer = function (name, hrService) {
|
||||
const newLayer = canvas_.getCurrentDrawing().createLayer(
|
||||
|
@ -803,7 +803,7 @@ export const createLayer = function (name, hrService) {
|
|||
* @param {string} name - The given name. If the layer name exists, a new name will be generated.
|
||||
* @param {module:history.HistoryRecordingService} hrService - History recording service
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const cloneLayer = function (name, hrService) {
|
||||
// Clone the current layer and make the cloned layer the new current layer
|
||||
|
@ -957,7 +957,7 @@ export const moveSelectedToLayer = function (layerName) {
|
|||
/**
|
||||
* @function module:draw.mergeLayer
|
||||
* @param {module:history.HistoryRecordingService} hrService
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const mergeLayer = function (hrService) {
|
||||
canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(hrService));
|
||||
|
@ -969,7 +969,7 @@ export const mergeLayer = function (hrService) {
|
|||
/**
|
||||
* @function module:draw.mergeAllLayers
|
||||
* @param {module:history.HistoryRecordingService} hrService
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const mergeAllLayers = function (hrService) {
|
||||
canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(hrService));
|
||||
|
@ -983,7 +983,7 @@ export const mergeAllLayers = function (hrService) {
|
|||
* disabled elements enabled again.
|
||||
* @function module:draw.leaveContext
|
||||
* @fires module:svgcanvas.SvgCanvas#event:contextset
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const leaveContext = function () {
|
||||
const len = disabledElems.length;
|
||||
|
@ -1010,7 +1010,7 @@ export const leaveContext = function () {
|
|||
* @function module:draw.setContext
|
||||
* @param {Element} elem
|
||||
* @fires module:svgcanvas.SvgCanvas#event:contextset
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setContext = function (elem) {
|
||||
leaveContext();
|
||||
|
|
|
@ -13,7 +13,7 @@ let svgCanvas = null;
|
|||
/**
|
||||
* @param {string} data
|
||||
* @param {string} error
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function handleSvgData (data, error) {
|
||||
if (error) {
|
||||
|
@ -27,7 +27,7 @@ function handleSvgData (data, error) {
|
|||
|
||||
/**
|
||||
* Set the canvas with an example SVG string.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function loadSvg () {
|
||||
const svgexample = '<svg width="640" height="480" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"><g><title>Layer 1</title><rect stroke-width="5" stroke="#000000" fill="#FF0000" id="svg_1" height="35" width="51" y="35" x="32"/><ellipse ry="15" rx="24" stroke-width="5" stroke="#000000" fill="#0000ff" id="svg_2" cy="60" cx="66"/></g></svg>';
|
||||
|
@ -36,7 +36,7 @@ function loadSvg () {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function saveSvg () {
|
||||
svgCanvas.getSvgString()(handleSvgData);
|
||||
|
@ -44,7 +44,7 @@ function saveSvg () {
|
|||
|
||||
/**
|
||||
* Perform a PNG export.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function exportPNG () {
|
||||
svgCanvas.getUIStrings()(function (uiStrings) {
|
||||
|
@ -62,7 +62,7 @@ function exportPNG () {
|
|||
|
||||
/**
|
||||
* Perform a PDF export.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function exportPDF () {
|
||||
svgCanvas.getUIStrings()(function (uiStrings) {
|
||||
|
|
|
@ -8,7 +8,7 @@ let cbid = 0;
|
|||
/**
|
||||
* @callback module:EmbeddedSVGEdit.CallbackSetter
|
||||
* @param {GenericCallback} newCallback Callback to be stored (signature dependent on function)
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @callback module:EmbeddedSVGEdit.CallbackSetGetter
|
||||
|
@ -37,7 +37,7 @@ function getCallbackSetter (funcName) {
|
|||
* of same domain control.
|
||||
* @param {module:EmbeddedSVGEdit.EmbeddedSVGEdit} t The `this` value
|
||||
* @param {JSON} data
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addCallback (t, {result, error, id: callbackID}) {
|
||||
if (typeof callbackID === 'number' && t.callbacks[callbackID]) {
|
||||
|
@ -53,7 +53,7 @@ function addCallback (t, {result, error, id: callbackID}) {
|
|||
|
||||
/**
|
||||
* @param {Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function messageListener (e) {
|
||||
// We accept and post strings as opposed to objects for the sake of IE9 support; this
|
||||
|
@ -76,7 +76,7 @@ function messageListener (e) {
|
|||
/**
|
||||
* @callback module:EmbeddedSVGEdit.MessageListener
|
||||
* @param {MessageEvent} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @param {module:EmbeddedSVGEdit.EmbeddedSVGEdit} t The `this` value
|
||||
|
|
|
@ -22,7 +22,7 @@ export default {
|
|||
/**
|
||||
* @param {Window} win
|
||||
* @param {!(string|Integer)} n
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setArrowNonce (win, n) {
|
||||
randomizeIds = true;
|
||||
|
@ -33,7 +33,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {Window} win
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function unsetArrowNonce (win) {
|
||||
randomizeIds = false;
|
||||
|
@ -74,7 +74,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
$('#arrow_panel').toggle(on);
|
||||
|
@ -107,7 +107,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function resetMarker () {
|
||||
const el = selElems[0];
|
||||
|
@ -165,7 +165,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setArrow () {
|
||||
resetMarker();
|
||||
|
@ -196,7 +196,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function colorChanged (elem) {
|
||||
const color = elem.getAttribute('stroke');
|
||||
|
|
|
@ -89,7 +89,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
let connRules = $('#connector_rules');
|
||||
|
@ -106,7 +106,7 @@ export default {
|
|||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
* @param {boolean} [setMid]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setPoint (elem, pos, x, y, setMid) {
|
||||
const pts = elem.points;
|
||||
|
@ -139,7 +139,7 @@ export default {
|
|||
/**
|
||||
* @param {Float} diffX
|
||||
* @param {Float} diffY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateLine (diffX, diffY) {
|
||||
// Update line with element
|
||||
|
@ -178,7 +178,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {Element[]} [elems=selElems] Array of elements
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function findConnectors (elems = selElems) {
|
||||
const connectors = $(svgcontent).find(connSel);
|
||||
|
@ -189,7 +189,7 @@ export default {
|
|||
let addThis;
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function add () {
|
||||
if (elems.includes(this)) {
|
||||
|
@ -240,7 +240,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {Element[]} [elems=selElems]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateConnectors (elems) {
|
||||
// Updates connector lines based on selected elements
|
||||
|
@ -317,7 +317,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Do on reset.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function init () {
|
||||
// Make sure all connectors have data set
|
||||
|
|
|
@ -28,7 +28,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged|module:svgcanvas.SvgCanvas#event:ext-elementChanged} opts
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function getStyle (opts) {
|
||||
// if we are in eyedropper mode, we don't want to disable the eye-dropper tool
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
let fcRules = $('#fc_rules');
|
||||
|
@ -40,7 +40,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleSourceButtons (on) {
|
||||
$('#tool_source_save, #tool_source_cancel').toggle(!on);
|
||||
|
@ -78,7 +78,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showForeignEditor () {
|
||||
const elt = selElems[0];
|
||||
|
@ -97,7 +97,7 @@ export default {
|
|||
/**
|
||||
* @param {string} attr
|
||||
* @param {string|Float} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setAttr (attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
|
|
|
@ -74,7 +74,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {Float} zoom
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateGrid (zoom) {
|
||||
// TODO: Try this with <line> elements, then compare performance difference
|
||||
|
@ -127,7 +127,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function gridUpdate () {
|
||||
if (showGrid) {
|
||||
|
|
|
@ -41,7 +41,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function closeBrowser () {
|
||||
$('#imgbrowse_holder').hide();
|
||||
|
@ -49,7 +49,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function importImage (url) {
|
||||
const newImage = svgCanvas.addSVGElementFromJson({
|
||||
|
@ -289,7 +289,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} show
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleMulti (show) {
|
||||
$('#lib_framewrap, #imglib_opts').css({right: (show ? 200 : 10)});
|
||||
|
@ -333,7 +333,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showBrowser () {
|
||||
let browser = $('#imgbrowse');
|
||||
|
|
|
@ -97,7 +97,7 @@ export default {
|
|||
*
|
||||
* @param {"start"|"mid"|"end"} pos
|
||||
* @param {string} id
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setIcon (pos, id) {
|
||||
if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; }
|
||||
|
@ -111,7 +111,7 @@ export default {
|
|||
* Toggles context tool panel off/on. Sets the controls with the
|
||||
* selected element's settings.
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
$('#marker_panel').toggle(on);
|
||||
|
@ -147,7 +147,7 @@ export default {
|
|||
/**
|
||||
* @param {string} id
|
||||
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addMarker (id, val) {
|
||||
const txtBoxBg = '#ffffff';
|
||||
|
@ -295,7 +295,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setMarker () {
|
||||
const poslist = {start_marker: 'start', mid_marker: 'mid', end_marker: 'end'};
|
||||
|
@ -327,7 +327,7 @@ export default {
|
|||
* Called when the main system modifies an object. This routine changes
|
||||
* the associated markers to be the same color.
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function colorChanged (elem) {
|
||||
const color = elem.getAttribute('stroke');
|
||||
|
@ -349,7 +349,7 @@ export default {
|
|||
* Called when the main system creates or modifies an object.
|
||||
* Its primary purpose is to create new markers for cloned objects.
|
||||
* @param {Element} el
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateReferences (el) {
|
||||
$.each(mtypes, function (i, pos) {
|
||||
|
@ -376,7 +376,7 @@ export default {
|
|||
/**
|
||||
* @param {"start"|"mid"|"end"} pos
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function triggerTextEntry (pos, val) {
|
||||
$('#' + pos + '_marker').val(val);
|
||||
|
@ -443,7 +443,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function getTitle (id) {
|
||||
const {langList} = strings;
|
||||
|
|
|
@ -67,7 +67,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function saveMath () {
|
||||
const code = $('#mathjax_code_textarea').val();
|
||||
|
|
|
@ -55,7 +55,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
$('#placemark_panel').toggle(on);
|
||||
|
@ -80,7 +80,7 @@ export default {
|
|||
/**
|
||||
* Called when text is changed.
|
||||
* @param {string} txt
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateText (txt) {
|
||||
const items = txt.split(';');
|
||||
|
@ -98,7 +98,7 @@ export default {
|
|||
/**
|
||||
* Called when font is changed.
|
||||
* @param {string} font
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateFont (font) {
|
||||
font = font.split(' ');
|
||||
|
@ -118,7 +118,7 @@ export default {
|
|||
/**
|
||||
* @param {string} id
|
||||
* @param {""|"\\nomarker"|"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"textmarker_top"|"textmarker_bottom"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addMarker (id, val) {
|
||||
let marker = svgCanvas.getElem(id);
|
||||
|
@ -177,7 +177,7 @@ export default {
|
|||
/**
|
||||
* @param {Element} el
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setMarker (el, val) {
|
||||
const markerName = 'marker-start';
|
||||
|
@ -199,7 +199,7 @@ export default {
|
|||
* Called when the main system modifies an object. This routine changes
|
||||
* the associated markers to be the same color.
|
||||
* @param {Element} el
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function colorChanged (el) {
|
||||
const color = el.getAttribute('stroke');
|
||||
|
@ -219,7 +219,7 @@ export default {
|
|||
* Called when the main system creates or modifies an object.
|
||||
* Its primary purpose is to create new markers for cloned objects.
|
||||
* @param {Element} el
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateReferences (el) {
|
||||
const id = 'placemark_marker_' + el.id;
|
||||
|
@ -251,7 +251,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {"nomarker"|"leftarrow"|"rightarrow"|"textmarker"|"forwardslash"|"reverseslash"|"verticalslash"|"box"|"star"|"xmark"|"triangle"|"mcircle"} id
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function getTitle (id) {
|
||||
const {langList} = strings;
|
||||
|
|
|
@ -38,7 +38,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
let fcRules = $('#fc_rules');
|
||||
|
@ -59,7 +59,7 @@ export default {
|
|||
/**
|
||||
* @param {string} attr
|
||||
* @param {string|Float} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setAttr (attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
|
|
|
@ -210,7 +210,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {external:jQuery} form
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function rebuildInput (form) {
|
||||
form.empty();
|
||||
|
@ -219,7 +219,7 @@ export default {
|
|||
/**
|
||||
* Submit the form, empty its contents for reuse and show
|
||||
* uploading message.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
async function submit () {
|
||||
// This submits the form, which returns the file data using `svgEditor.processFile()`
|
||||
|
|
|
@ -63,7 +63,7 @@ export default {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function loadIcons () {
|
||||
$('#shape_buttons').empty().append(curLib.buttons);
|
||||
|
@ -79,7 +79,7 @@ export default {
|
|||
/**
|
||||
* @param {string|"basic"} cat Category ID
|
||||
* @param {module:Extension.Shapes.Shapes} shapes
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function makeButtons (cat, shapes) {
|
||||
const size = curLib.size || 300;
|
||||
|
@ -118,7 +118,7 @@ export default {
|
|||
|
||||
/**
|
||||
* @param {string|"basic"} catId
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function loadLibrary (catId) {
|
||||
const lib = library[catId];
|
||||
|
|
|
@ -27,7 +27,7 @@ export default {
|
|||
/**
|
||||
*
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function showPanel (on) {
|
||||
let fcRules = $('#fc_rules');
|
||||
|
@ -48,7 +48,7 @@ export default {
|
|||
*
|
||||
* @param {string} attr
|
||||
* @param {string|Float} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setAttr (attr, val) {
|
||||
svgCanvas.changeSelectedAttribute(attr, val);
|
||||
|
|
|
@ -50,7 +50,7 @@ export default {
|
|||
/**
|
||||
* Replace `storagePrompt` parameter within URL.
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function replaceStoragePrompt (val) {
|
||||
val = val ? 'storagePrompt=' + val : '';
|
||||
|
@ -68,7 +68,7 @@ export default {
|
|||
* Sets SVG content as a string with "svgedit-" and the current
|
||||
* canvas name as namespace.
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setSVGContentStorage (val) {
|
||||
if (storage) {
|
||||
|
@ -84,7 +84,7 @@ export default {
|
|||
/**
|
||||
* Set the cookie to expire.
|
||||
* @param {string} cookie
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function expireCookie (cookie) {
|
||||
document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
|
@ -92,7 +92,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Expire the storage cookie.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function removeStoragePrefCookie () {
|
||||
expireCookie('svgeditstore');
|
||||
|
@ -100,7 +100,7 @@ export default {
|
|||
|
||||
/**
|
||||
* Empties storage for each of the current preferences.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function emptyStorage () {
|
||||
setSVGContentStorage('');
|
||||
|
@ -122,7 +122,7 @@ export default {
|
|||
* content into storage)
|
||||
* 2. Use localStorage to set SVG contents (potentially too large to allow in cookies)
|
||||
* 3. Use localStorage (where available) or cookies to set preferences.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setupBeforeUnloadListener () {
|
||||
window.addEventListener('beforeunload', function (e) {
|
||||
|
|
|
@ -22,7 +22,7 @@ export default {
|
|||
* @param {module:svgcanvas.SvgCanvas#event:message} data
|
||||
* @listens module:svgcanvas.SvgCanvas#event:message
|
||||
* @throws {Error} Unexpected event type
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
(win, {data, origin}) => { // eslint-disable-line no-shadow
|
||||
// console.log('data, origin', data, origin);
|
||||
|
|
|
@ -11,7 +11,7 @@ const jsVoid = 'javascript: void(0);'; // eslint-disable-line no-script-url
|
|||
/**
|
||||
* Shows results after query submission.
|
||||
* @param {string} url
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
async function processResults (url) {
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* @param {Node} o
|
||||
* @param {module:DOMPolyfill~ParentNode|module:DOMPolyfill~ChildNode} ps
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mixin (o, ps) {
|
||||
if (!o) return;
|
||||
|
|
|
@ -20,7 +20,7 @@ function toAbsoluteURL (url) {
|
|||
* Add any of the whitelisted attributes to the script tag.
|
||||
* @param {HTMLScriptElement} script
|
||||
* @param {PlainObject.<string, string>} atts
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addScriptAtts (script, atts) {
|
||||
['id', 'class', 'type'].forEach((prop) => {
|
||||
|
@ -81,7 +81,7 @@ export function importScript (url, atts = {}) {
|
|||
const script = document.createElement('script');
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function scriptOnError () {
|
||||
reject(new Error(`Failed to import: ${url}`));
|
||||
|
@ -89,7 +89,7 @@ export function importScript (url, atts = {}) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function scriptOnLoad () {
|
||||
resolve();
|
||||
|
@ -131,7 +131,7 @@ export function importModule (url, atts = {}, {returnDefault = false} = {}) {
|
|||
const script = document.createElement('script');
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function scriptOnError () {
|
||||
reject(new Error(`Failed to import: ${url}`));
|
||||
|
@ -139,7 +139,7 @@ export function importModule (url, atts = {}, {returnDefault = false} = {}) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function scriptOnLoad () {
|
||||
resolve(window[vector]);
|
||||
|
|
|
@ -46,7 +46,7 @@ class Command {
|
|||
* @function module:history.HistoryCommand#apply
|
||||
* @param {module:history.HistoryEventHandler}
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined|true}
|
||||
* @returns {void|true}
|
||||
*/
|
||||
/**
|
||||
*
|
||||
|
@ -54,7 +54,7 @@ class Command {
|
|||
* @function module:history.HistoryCommand#unapply
|
||||
* @param {module:history.HistoryEventHandler}
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined|true}
|
||||
* @returns {void|true}
|
||||
*/
|
||||
/**
|
||||
* Returns the elements
|
||||
|
@ -92,7 +92,7 @@ class Command {
|
|||
* @param {string} eventType One of the HistoryEvent types
|
||||
* @param {module:history~Command#event:history} command
|
||||
* @listens module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -122,7 +122,7 @@ export class MoveElementCommand extends Command {
|
|||
* Re-positions the element.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
apply (handler) {
|
||||
// TODO(codedread): Refactor this common event code into a base HistoryCommand class.
|
||||
|
@ -141,7 +141,7 @@ export class MoveElementCommand extends Command {
|
|||
* Positions the element back to its original location.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
unapply (handler) {
|
||||
if (handler) {
|
||||
|
@ -188,7 +188,7 @@ export class InsertElementCommand extends Command {
|
|||
* Re-inserts the new element.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
apply (handler) {
|
||||
if (handler) {
|
||||
|
@ -206,7 +206,7 @@ export class InsertElementCommand extends Command {
|
|||
* Removes the element.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
unapply (handler) {
|
||||
if (handler) {
|
||||
|
@ -257,7 +257,7 @@ export class RemoveElementCommand extends Command {
|
|||
* Re-removes the new element.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
apply (handler) {
|
||||
if (handler) {
|
||||
|
@ -277,7 +277,7 @@ export class RemoveElementCommand extends Command {
|
|||
* Re-adds the new element.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
unapply (handler) {
|
||||
if (handler) {
|
||||
|
@ -481,7 +481,7 @@ export class BatchCommand extends Command {
|
|||
* Runs "apply" on all subcommands.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
apply (handler) {
|
||||
if (handler) {
|
||||
|
@ -502,7 +502,7 @@ export class BatchCommand extends Command {
|
|||
* Runs "unapply" on all subcommands.
|
||||
* @param {module:history.HistoryEventHandler} handler
|
||||
* @fires module:history~Command#event:history
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
unapply (handler) {
|
||||
if (handler) {
|
||||
|
@ -538,7 +538,7 @@ export class BatchCommand extends Command {
|
|||
/**
|
||||
* Adds a given command to the history stack.
|
||||
* @param {Command} cmd - The undo command object to add
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addSubCommand (cmd) {
|
||||
this.stack.push(cmd);
|
||||
|
@ -573,7 +573,7 @@ export class UndoManager {
|
|||
|
||||
/**
|
||||
* Resets the undo stack, effectively clearing the undo/redo history.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
resetUndoStack () {
|
||||
this.undoStack = [];
|
||||
|
@ -610,7 +610,7 @@ export class UndoManager {
|
|||
|
||||
/**
|
||||
* Performs an undo step.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
undo () {
|
||||
if (this.undoStackPointer > 0) {
|
||||
|
@ -621,7 +621,7 @@ export class UndoManager {
|
|||
|
||||
/**
|
||||
* Performs a redo step.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
redo () {
|
||||
if (this.undoStackPointer < this.undoStack.length && this.undoStack.length > 0) {
|
||||
|
@ -633,7 +633,7 @@ export class UndoManager {
|
|||
/**
|
||||
* Adds a command object to the undo history stack.
|
||||
* @param {Command} cmd - The command object to add
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addCommandToHistory (cmd) {
|
||||
// FIXME: we MUST compress consecutive text changes to the same element
|
||||
|
@ -658,7 +658,7 @@ export class UndoManager {
|
|||
* from the DOM and uses all of these to construct the undo-able command.
|
||||
* @param {string} attrName - The name of the attribute being changed
|
||||
* @param {Element[]} elems - Array of DOM elements being changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
beginUndoableChange (attrName, elems) {
|
||||
const p = ++this.undoChangeStackPointer;
|
||||
|
|
|
@ -141,7 +141,7 @@ class HistoryRecordingService {
|
|||
* Private function to add a command to the history or current batch command.
|
||||
* @private
|
||||
* @param {Command} cmd
|
||||
* @returns {module:history.HistoryRecordingService|undefined}
|
||||
* @returns {module:history.HistoryRecordingService|void}
|
||||
*/
|
||||
addCommand_ (cmd) {
|
||||
if (!this.undoManager_) { return this; }
|
||||
|
|
|
@ -205,7 +205,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
/**
|
||||
* @param {SVGElement} elem
|
||||
* @param {module:jGraduate.Attrs} attrs
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setAttrs (elem, attrs) {
|
||||
if (isGecko) {
|
||||
|
@ -257,11 +257,11 @@ export default function jQueryPluginJGraduate ($) {
|
|||
/**
|
||||
* @callback external:jQuery.fn.jGraduate.OkCallback
|
||||
* @param {external:jQuery.jGraduate.Paint} paint
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @callback external:jQuery.fn.jGraduate.CancelCallback
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -727,7 +727,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function remStop () {
|
||||
delStop.setAttribute('display', 'none');
|
||||
|
@ -751,7 +751,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
|
||||
/**
|
||||
* @param {Element} item
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function selectStop (item) {
|
||||
if (curStop) curStop.setAttribute('stroke', '#000');
|
||||
|
@ -766,7 +766,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function remDrags () {
|
||||
$win.unbind('mousemove', dragColor);
|
||||
|
@ -782,7 +782,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
let cY = cy;
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function xform () {
|
||||
const rot = angle ? 'rotate(' + angle + ',' + cX + ',' + cY + ') ' : '';
|
||||
|
@ -799,7 +799,7 @@ export default function jQueryPluginJGraduate ($) {
|
|||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function dragColor (evt) {
|
||||
let x = evt.pageX - stopOffset.left;
|
||||
|
|
|
@ -74,7 +74,7 @@ const jPicker = function ($) {
|
|||
* @memberof module:jPicker
|
||||
* @param {external:jQuery} bar
|
||||
* @param {module:jPicker.SliderOptions} options
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
class Slider {
|
||||
constructor (bar, options) {
|
||||
|
@ -82,7 +82,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* Fire events on the supplied `context`
|
||||
* @param {module:jPicker.JPickerInit} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function fireChangeEvents (context) {
|
||||
changeEvents.forEach((changeEvent) => {
|
||||
|
@ -93,7 +93,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* Bind the mousedown to the bar not the arrow for quick snapping to the clicked location.
|
||||
* @param {external:jQuery.Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mouseDown (e) {
|
||||
const off = bar.offset();
|
||||
|
@ -136,7 +136,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* Calculate mouse position and set value within the current range.
|
||||
* @param {Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setValuesFromMousePosition (e) {
|
||||
const barW = bar.w, // local copies for YUI compressor
|
||||
|
@ -155,7 +155,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function draw () {
|
||||
const
|
||||
|
@ -192,7 +192,7 @@ const jPicker = function ($) {
|
|||
* @param {?("xy"|"x"|"y")} name
|
||||
* @param {module:math.XYObject} value
|
||||
* @param {module:jPicker.Slider} context
|
||||
* @returns {module:math.XYObject|Float|undefined}
|
||||
* @returns {module:math.XYObject|Float|void}
|
||||
*/
|
||||
function val (name, value, context) {
|
||||
const set = value !== undefined;
|
||||
|
@ -263,7 +263,7 @@ const jPicker = function ($) {
|
|||
*
|
||||
* @param {"minx"|"maxx"|"rangex"|"miny"|"maxy"|"rangey"|"all"} name
|
||||
* @param {module:jPicker.MinMaxRangeXY} value
|
||||
* @returns {module:jPicker.MinMaxRangeXY|module:jPicker.MinMaxRangeX|module:jPicker.MinMaxRangeY|undefined}
|
||||
* @returns {module:jPicker.MinMaxRangeXY|module:jPicker.MinMaxRangeX|module:jPicker.MinMaxRangeY|void}
|
||||
*/
|
||||
function range (name, value) {
|
||||
const set = value !== undefined;
|
||||
|
@ -336,14 +336,14 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {GenericCallback} callback
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function bind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
if (typeof callback === 'function') changeEvents.push(callback);
|
||||
}
|
||||
/**
|
||||
* @param {GenericCallback} callback
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function unbind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
if (typeof callback !== 'function') return;
|
||||
|
@ -352,7 +352,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function destroy () {
|
||||
// unbind all possible events and null objects
|
||||
|
@ -416,7 +416,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
*
|
||||
* @param {Event} e
|
||||
* @returns {Event|false|undefined}
|
||||
* @returns {Event|false|void}
|
||||
*/
|
||||
function keyDown (e) {
|
||||
if (e.target.value === '' && e.target !== hex.get(0) && ((!isNullish(bindedHex) && e.target !== bindedHex.get(0)) || isNullish(bindedHex))) return undefined;
|
||||
|
@ -512,7 +512,7 @@ const jPicker = function ($) {
|
|||
// input box key up - validate value and set color
|
||||
/**
|
||||
* @param {Event} e
|
||||
* @returns {Event|undefined}
|
||||
* @returns {Event|void}
|
||||
* @todo Why is this returning an event?
|
||||
*/
|
||||
function keyUp (e) {
|
||||
|
@ -569,7 +569,7 @@ const jPicker = function ($) {
|
|||
// input box blur - reset to original if value empty
|
||||
/**
|
||||
* @param {Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function blur (e) {
|
||||
if (!isNullish(color.val())) {
|
||||
|
@ -625,7 +625,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @param {Element} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function colorChanged (ui, context) {
|
||||
const all = ui.val('all');
|
||||
|
@ -642,7 +642,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* Unbind all events and null objects.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function destroy () {
|
||||
red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).unbind('keyup', keyUp).unbind('blur', blur);
|
||||
|
@ -718,17 +718,17 @@ const jPicker = function ($) {
|
|||
/**
|
||||
*
|
||||
* @param {module:jPicker.Slider} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function fireChangeEvents (context) {
|
||||
for (let i = 0; i < changeEvents.length; i++) changeEvents[i].call(that, that, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string|"ahex"|"hex"|"all"|""|null|undefined} name String composed of letters "r", "g", "b", "a", "h", "s", and/or "v"
|
||||
* @param {string|"ahex"|"hex"|"all"|""|null|void} name String composed of letters "r", "g", "b", "a", "h", "s", and/or "v"
|
||||
* @param {module:jPicker.RGBA|module:jPicker.JPickerInit|string} [value]
|
||||
* @param {external:jQuery.jPicker.Color} context
|
||||
* @returns {module:jPicker.JPickerInit|string|null|undefined}
|
||||
* @returns {module:jPicker.JPickerInit|string|null|void}
|
||||
*/
|
||||
function val (name, value, context) {
|
||||
// Kind of ugly
|
||||
|
@ -955,14 +955,14 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {GenericCallback} callback
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function bind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
if (typeof callback === 'function') changeEvents.push(callback);
|
||||
}
|
||||
/**
|
||||
* @param {GenericCallback} callback
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function unbind (callback) { // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
if (typeof callback !== 'function') return;
|
||||
|
@ -973,7 +973,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* Unset `changeEvents`
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function destroy () {
|
||||
changeEvents = null;
|
||||
|
@ -1194,19 +1194,19 @@ const jPicker = function ($) {
|
|||
* @callback module:jPicker.LiveCallback
|
||||
* @param {external:jQuery} ui
|
||||
* @param {Element} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @callback module:jPicker.CommitCallback
|
||||
* @param {external:jQuery.jPicker.Color} activeColor
|
||||
* @param {external:jQuery} okButton
|
||||
* @returns {undefined} Return value not used.
|
||||
* @returns {void} Return value not used.
|
||||
*/
|
||||
/**
|
||||
* @callback module:jPicker.CancelCallback
|
||||
* @param {external:jQuery.jPicker.Color} activeColor
|
||||
* @param {external:jQuery} cancelButton
|
||||
* @returns {undefined} Return value not used.
|
||||
* @returns {void} Return value not used.
|
||||
*/
|
||||
/**
|
||||
* While it would seem this should specify the name `jPicker` for JSDoc, that doesn't
|
||||
|
@ -1251,7 +1251,7 @@ const jPicker = function ($) {
|
|||
*
|
||||
* @param {"h"|"s"|"v"|"r"|"g"|"b"|"a"} colorMode
|
||||
* @throws {Error} Invalid mode
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setColorMode (colorMode) {
|
||||
const {active} = color, // local copies for YUI compressor
|
||||
|
@ -1407,7 +1407,7 @@ const jPicker = function ($) {
|
|||
* Update color when user changes text values.
|
||||
* @param {external:jQuery} ui
|
||||
* @param {?module:jPicker.Slider} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function activeColorChanged (ui, context) {
|
||||
if (isNullish(context) || (context !== colorBar && context !== colorMap)) positionMapAndBarArrows.call(that, ui, context);
|
||||
|
@ -1422,7 +1422,7 @@ const jPicker = function ($) {
|
|||
* User has dragged the ColorMap pointer.
|
||||
* @param {external:jQuery} ui
|
||||
* @param {?module:jPicker.Slider} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mapValueChanged (ui, context) {
|
||||
const {active} = color;
|
||||
|
@ -1455,7 +1455,7 @@ const jPicker = function ($) {
|
|||
* User has dragged the ColorBar slider.
|
||||
* @param {external:jQuery} ui
|
||||
* @param {?module:jPicker.Slider} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function colorBarValueChanged (ui, context) {
|
||||
const {active} = color;
|
||||
|
@ -1489,7 +1489,7 @@ const jPicker = function ($) {
|
|||
* Position map and bar arrows to match current color.
|
||||
* @param {external:jQuery} ui
|
||||
* @param {?module:jPicker.Slider} context
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function positionMapAndBarArrows (ui, context) {
|
||||
if (context !== colorMap) {
|
||||
|
@ -1555,7 +1555,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updatePreview (ui) {
|
||||
try {
|
||||
|
@ -1566,7 +1566,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateMapVisuals (ui) {
|
||||
switch (settings.color.mode) {
|
||||
|
@ -1597,7 +1597,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function updateBarVisuals (ui) {
|
||||
switch (settings.color.mode) {
|
||||
|
@ -1651,7 +1651,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* @param {external:jQuery} el
|
||||
* @param {string} [c="transparent"]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setBG (el, c) {
|
||||
el.css({backgroundColor: (c && c.length === 6 && '#' + c) || 'transparent'});
|
||||
|
@ -1660,7 +1660,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* @param {external:jQuery} img
|
||||
* @param {string} src The image source
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setImg (img, src) {
|
||||
if (isLessThanIE7 && (src.includes('AlphaBar.png') || src.includes('Bars.png') || src.includes('Maps.png'))) {
|
||||
|
@ -1671,7 +1671,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* @param {external:jQuery} img
|
||||
* @param {Float} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setImgLoc (img, y) {
|
||||
img.css({top: y + 'px'});
|
||||
|
@ -1679,7 +1679,7 @@ const jPicker = function ($) {
|
|||
/**
|
||||
* @param {external:jQuery} obj
|
||||
* @param {Float} alpha
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setAlpha (obj, alpha) {
|
||||
obj.css({visibility: alpha > 0 ? 'visible' : 'hidden'});
|
||||
|
@ -1712,21 +1712,21 @@ const jPicker = function ($) {
|
|||
|
||||
/**
|
||||
* Revert color to original color when opened.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function revertColor () {
|
||||
color.active.val('ahex', color.current.val('ahex'));
|
||||
}
|
||||
/**
|
||||
* Commit the color changes.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function commitColor () {
|
||||
color.current.val('ahex', color.active.val('ahex'));
|
||||
}
|
||||
/**
|
||||
* @param {Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function radioClicked (e) {
|
||||
$(this).parents('tbody:first').find('input:radio[value!="' + e.target.value + '"]').removeAttr('checked');
|
||||
|
@ -1734,14 +1734,14 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function currentClicked () {
|
||||
revertColor.call(that);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function cancelClicked () {
|
||||
revertColor.call(that);
|
||||
|
@ -1750,7 +1750,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function okClicked () {
|
||||
commitColor.call(that);
|
||||
|
@ -1759,14 +1759,14 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function iconImageClicked () {
|
||||
show.call(that);
|
||||
}
|
||||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function currentColorChanged (ui) {
|
||||
const hex = ui.val('hex');
|
||||
|
@ -1775,7 +1775,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {external:jQuery} ui
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function expandableColorChanged (ui) {
|
||||
const hex = ui.val('hex');
|
||||
|
@ -1791,7 +1791,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
* @param {Event} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function moveBarMouseDown (e) {
|
||||
// const {element} = settings.window, // local copies for YUI compressor
|
||||
|
@ -1845,13 +1845,13 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function show () {
|
||||
color.current.val('ahex', color.active.val('ahex'));
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function attachIFrame () {
|
||||
if (!settings.window.expandable || $.support.boxModel) return;
|
||||
|
@ -1885,12 +1885,12 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function hide () {
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function removeIFrame () {
|
||||
if (settings.window.expandable) container.css({zIndex: 10});
|
||||
|
@ -1912,7 +1912,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function initialize () {
|
||||
const win = settings.window,
|
||||
|
@ -2128,7 +2128,7 @@ const jPicker = function ($) {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function destroy () {
|
||||
container.find('td.Radio input').unbind('click', radioClicked);
|
||||
|
|
|
@ -76,7 +76,7 @@ class Layer {
|
|||
|
||||
/**
|
||||
* Active this layer so it takes pointer events.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
activate () {
|
||||
this.group_.setAttribute('style', 'pointer-events:all');
|
||||
|
@ -84,7 +84,7 @@ class Layer {
|
|||
|
||||
/**
|
||||
* Deactive this layer so it does NOT take pointer events.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
deactivate () {
|
||||
this.group_.setAttribute('style', 'pointer-events:none');
|
||||
|
@ -93,7 +93,7 @@ class Layer {
|
|||
/**
|
||||
* Set this layer visible or hidden based on 'visible' parameter.
|
||||
* @param {boolean} visible - If true, make visible; otherwise, hide it.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setVisible (visible) {
|
||||
const expected = visible === undefined || visible ? 'inline' : 'none';
|
||||
|
@ -127,7 +127,7 @@ class Layer {
|
|||
* Sets the opacity of this layer. If opacity is not a value between 0.0 and 1.0,
|
||||
* nothing happens.
|
||||
* @param {Float} opacity - A float value in the range 0.0-1.0
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setOpacity (opacity) {
|
||||
if (typeof opacity === 'number' && opacity >= 0.0 && opacity <= 1.0) {
|
||||
|
@ -138,7 +138,7 @@ class Layer {
|
|||
/**
|
||||
* Append children to this layer.
|
||||
* @param {SVGGElement} children - The children to append to this layer.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
appendChildren (children) {
|
||||
for (let i = 0; i < children.length; ++i) {
|
||||
|
@ -208,7 +208,7 @@ Layer.CLASS_REGEX = new RegExp('(\\s|^)' + Layer.CLASS_NAME + '(\\s|$)');
|
|||
* Add class `Layer.CLASS_NAME` to the element (usually `class='layer'`).
|
||||
*
|
||||
* @param {SVGGElement} elem - The SVG element to update
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addLayerClass (elem) {
|
||||
const classes = elem.getAttribute('class');
|
||||
|
|
|
@ -48,7 +48,7 @@ let langParam;
|
|||
* @param {"content"|"title"} type
|
||||
* @param {module:locale.LocaleSelectorValue} obj Selectors or IDs keyed to strings
|
||||
* @param {boolean} ids
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setStrings = function (type, obj, ids) {
|
||||
// Root element to look for element from
|
||||
|
@ -111,7 +111,7 @@ let editor_;
|
|||
* @function init
|
||||
* @memberof module:locale
|
||||
* @param {module:locale.LocaleEditorInit} editor
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = (editor) => {
|
||||
editor_ = editor;
|
||||
|
|
112
editor/path.js
112
editor/path.js
|
@ -49,7 +49,7 @@ const uiStrings = {};
|
|||
/**
|
||||
* @function module:path.setUiStrings
|
||||
* @param {module:path.uiStrings} strs
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setUiStrings = function (strs) {
|
||||
Object.assign(uiStrings, strs.ui);
|
||||
|
@ -66,7 +66,7 @@ let pathData = {};
|
|||
/**
|
||||
* @function module:path.setLinkControlPoints
|
||||
* @param {boolean} lcp
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setLinkControlPoints = function (lcp) {
|
||||
linkControlPts = lcp;
|
||||
|
@ -103,12 +103,12 @@ let editorContext_ = null;
|
|||
* @function module:path.EditorContext#call
|
||||
* @param {"selected"|"changed"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function. If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:path.EditorContext#resetD
|
||||
* @param {SVGPathElement} p
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* Note: This doesn't round to an integer necessarily
|
||||
|
@ -163,7 +163,7 @@ let editorContext_ = null;
|
|||
/**
|
||||
* @function module:path.EditorContext#setStarted
|
||||
* @param {boolean} s
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:path.EditorContext#getRubberBox
|
||||
|
@ -179,14 +179,14 @@ let editorContext_ = null;
|
|||
* @param {PlainObject} cfg
|
||||
* @param {boolean} cfg.closedSubpath
|
||||
* @param {SVGCircleElement[]} cfg.grips
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:path.EditorContext#endChanges
|
||||
* @param {PlainObject} cfg
|
||||
* @param {string} cfg.cmd
|
||||
* @param {Element} cfg.elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:path.EditorContext#getCurrentZoom
|
||||
|
@ -234,7 +234,7 @@ let editorContext_ = null;
|
|||
/**
|
||||
* @function module:path.init
|
||||
* @param {module:path.EditorContext} editorContext
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (editorContext) {
|
||||
editorContext_ = editorContext;
|
||||
|
@ -255,7 +255,7 @@ export const init = function (editorContext) {
|
|||
* @param {Element} elem
|
||||
* @param {Segment} newseg
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const insertItemBefore = function (elem, newseg, index) {
|
||||
// Support insertItemBefore on paths for FF2
|
||||
|
@ -535,7 +535,7 @@ export const getControlPoints = function (seg) {
|
|||
* @param {Integer} index
|
||||
* @param {ArgumentsArray} pts
|
||||
* @param {SVGPathElement} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const replacePathSeg = function (type, index, pts, elem) {
|
||||
const pth = elem || path.elem;
|
||||
|
@ -689,7 +689,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {boolean} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
showCtrlPts (y) {
|
||||
for (const i in this.ctrlpts) {
|
||||
|
@ -701,7 +701,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {boolean} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
selectCtrls (y) {
|
||||
$('#ctrlpointgrip_' + this.index + 'c1, #ctrlpointgrip_' + this.index + 'c2')
|
||||
|
@ -710,7 +710,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {boolean} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
show (y) {
|
||||
if (this.ptgrip) {
|
||||
|
@ -723,7 +723,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {boolean} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
select (y) {
|
||||
if (this.ptgrip) {
|
||||
|
@ -737,7 +737,7 @@ export class Segment {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addGrip () {
|
||||
this.ptgrip = getPointGrip(this, true);
|
||||
|
@ -747,7 +747,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {boolean} full
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
update (full) {
|
||||
if (this.ptgrip) {
|
||||
|
@ -773,7 +773,7 @@ export class Segment {
|
|||
/**
|
||||
* @param {Integer} dx
|
||||
* @param {Integer} dy
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
move (dx, dy) {
|
||||
const {item} = this;
|
||||
|
@ -816,7 +816,7 @@ export class Segment {
|
|||
|
||||
/**
|
||||
* @param {Integer} num
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setLinked (num) {
|
||||
let seg, anum, pt;
|
||||
|
@ -850,7 +850,7 @@ export class Segment {
|
|||
* @param {Integer} num
|
||||
* @param {Integer} dx
|
||||
* @param {Integer} dy
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
moveCtrl (num, dx, dy) {
|
||||
const {item} = this;
|
||||
|
@ -869,7 +869,7 @@ export class Segment {
|
|||
/**
|
||||
* @param {Integer} newType Possible values set during {@link module:path.init}
|
||||
* @param {ArgumentsArray} pts
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setType (newType, pts) {
|
||||
replacePathSeg(newType, this.index, pts);
|
||||
|
@ -991,11 +991,11 @@ export class Path {
|
|||
* @callback module:path.PathEachSegCallback
|
||||
* @this module:path.Segment
|
||||
* @param {Integer} i The index of the seg being iterated
|
||||
* @returns {boolean|undefined} Will stop execution of `eachSeg` if returns `false`
|
||||
* @returns {boolean|void} Will stop execution of `eachSeg` if returns `false`
|
||||
*/
|
||||
/**
|
||||
* @param {module:path.PathEachSegCallback} fn
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
eachSeg (fn) {
|
||||
const len = this.segs.length;
|
||||
|
@ -1007,7 +1007,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addSeg (index) {
|
||||
// Adds a new segment
|
||||
|
@ -1048,7 +1048,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
deleteSeg (index) {
|
||||
const seg = this.segs[index];
|
||||
|
@ -1078,7 +1078,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
removePtFromSelection (index) {
|
||||
const pos = this.selected_pts.indexOf(index);
|
||||
|
@ -1090,7 +1090,7 @@ export class Path {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clearSelection () {
|
||||
this.eachSeg(function () {
|
||||
|
@ -1101,7 +1101,7 @@ export class Path {
|
|||
}
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
storeD () {
|
||||
this.last_d = this.elem.getAttribute('d');
|
||||
|
@ -1109,7 +1109,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {Integer} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
show (y) {
|
||||
// Shows this path's segment grips
|
||||
|
@ -1127,7 +1127,7 @@ export class Path {
|
|||
* Move selected points.
|
||||
* @param {Integer} dx
|
||||
* @param {Integer} dy
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
movePts (dx, dy) {
|
||||
let i = this.selected_pts.length;
|
||||
|
@ -1140,7 +1140,7 @@ export class Path {
|
|||
/**
|
||||
* @param {Integer} dx
|
||||
* @param {Integer} dy
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
moveCtrl (dx, dy) {
|
||||
const seg = this.segs[this.selected_pts[0]];
|
||||
|
@ -1152,7 +1152,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {?Integer} newType See {@link https://www.w3.org/TR/SVG/single-page.html#paths-InterfaceSVGPathSeg}
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setSegType (newType) {
|
||||
this.storeD();
|
||||
|
@ -1222,7 +1222,7 @@ export class Path {
|
|||
/**
|
||||
* @param {Integer} pt
|
||||
* @param {Integer} ctrlNum
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
selectPt (pt, ctrlNum) {
|
||||
this.clearSelection();
|
||||
|
@ -1268,7 +1268,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
endChanges (text) {
|
||||
if (isWebkit()) { editorContext_.resetD(this.elem); }
|
||||
|
@ -1278,7 +1278,7 @@ export class Path {
|
|||
|
||||
/**
|
||||
* @param {Integer|Integer[]} indexes
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addPtsToSelection (indexes) {
|
||||
if (!Array.isArray(indexes)) { indexes = [indexes]; }
|
||||
|
@ -1347,7 +1347,7 @@ export const getPath_ = function (elem) {
|
|||
/**
|
||||
* @function module:path.removePath_
|
||||
* @param {string} id
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const removePath_ = function (id) {
|
||||
if (id in pathData) { delete pathData[id]; }
|
||||
|
@ -1388,7 +1388,7 @@ const getRotVals = function (x, y) {
|
|||
* @function module:path.recalcRotatedPath
|
||||
* @todo This is still using ye olde transform methods, can probably
|
||||
* be optimized or even taken care of by `recalculateDimensions`
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const recalcRotatedPath = function () {
|
||||
const currentPath = path.elem;
|
||||
|
@ -1446,7 +1446,7 @@ export const recalcRotatedPath = function () {
|
|||
|
||||
/**
|
||||
* @function module:path.clearData
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const clearData = function () {
|
||||
pathData = {};
|
||||
|
@ -1457,7 +1457,7 @@ export const clearData = function () {
|
|||
* @function module:path.reorientGrads
|
||||
* @param {Element} elem
|
||||
* @param {SVGMatrix} m
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const reorientGrads = function (elem, m) {
|
||||
const bb = utilsGetBBox(elem);
|
||||
|
@ -1792,7 +1792,7 @@ export const pathActions = (function () {
|
|||
* @param {Element} mouseTarget
|
||||
* @param {Float} startX
|
||||
* @param {Float} startY
|
||||
* @returns {boolean|undefined}
|
||||
* @returns {boolean|void}
|
||||
*/
|
||||
mouseDown (evt, mouseTarget, startX, startY) {
|
||||
let id;
|
||||
|
@ -2042,7 +2042,7 @@ export const pathActions = (function () {
|
|||
/**
|
||||
* @param {Float} mouseX
|
||||
* @param {Float} mouseY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mouseMove (mouseX, mouseY) {
|
||||
const currentZoom = editorContext_.getCurrentZoom();
|
||||
|
@ -2178,7 +2178,7 @@ export const pathActions = (function () {
|
|||
* @param {Element} element
|
||||
* @param {Float} mouseX
|
||||
* @param {Float} mouseY
|
||||
* @returns {module:path.keepElement|undefined}
|
||||
* @returns {module:path.keepElement|void}
|
||||
*/
|
||||
mouseUp (evt, element, mouseX, mouseY) {
|
||||
const drawnPath = editorContext_.getDrawnPath();
|
||||
|
@ -2230,7 +2230,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {Element} element
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
toEditMode (element) {
|
||||
path = getPath_(element);
|
||||
|
@ -2243,7 +2243,7 @@ export const pathActions = (function () {
|
|||
/**
|
||||
* @param {Element} elem
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
toSelectMode (elem) {
|
||||
const selPath = (elem === path.elem);
|
||||
|
@ -2264,7 +2264,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {boolean} on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addSubPath (on) {
|
||||
if (on) {
|
||||
|
@ -2279,7 +2279,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {Element} target
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
select (target) {
|
||||
if (currentPath === target) {
|
||||
|
@ -2292,7 +2292,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
reorient () {
|
||||
const elem = editorContext_.getSelectedElements()[0];
|
||||
|
@ -2322,7 +2322,7 @@ export const pathActions = (function () {
|
|||
|
||||
/**
|
||||
* @param {boolean} remove Not in use
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clear (remove) {
|
||||
const drawnPath = editorContext_.getDrawnPath();
|
||||
|
@ -2342,7 +2342,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {?(Element|SVGPathElement)} pth
|
||||
* @returns {false|undefined}
|
||||
* @returns {false|void}
|
||||
*/
|
||||
resetOrientation (pth) {
|
||||
if (isNullish(pth) || pth.nodeName !== 'path') { return false; }
|
||||
|
@ -2384,7 +2384,7 @@ export const pathActions = (function () {
|
|||
return undefined;
|
||||
},
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
zoomChange () {
|
||||
if (editorContext_.getCurrentMode() === 'pathedit') {
|
||||
|
@ -2412,13 +2412,13 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {boolean} linkPoints
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
linkControlPoints (linkPoints) {
|
||||
setLinkControlPoints(linkPoints);
|
||||
},
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clonePathNode () {
|
||||
path.storeD();
|
||||
|
@ -2441,7 +2441,7 @@ export const pathActions = (function () {
|
|||
path.endChanges('Clone path node(s)');
|
||||
},
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
opencloseSubPath () {
|
||||
const selPts = path.selected_pts;
|
||||
|
@ -2553,7 +2553,7 @@ export const pathActions = (function () {
|
|||
path.init().selectPt(0);
|
||||
},
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
deletePathNode () {
|
||||
if (!pathActions.canDeleteNodes) { return; }
|
||||
|
@ -2643,7 +2643,7 @@ export const pathActions = (function () {
|
|||
smoothPolylineIntoPath,
|
||||
/**
|
||||
* @param {?Integer} v See {@link https://www.w3.org/TR/SVG/single-page.html#paths-InterfaceSVGPathSeg}
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setSegType (v) {
|
||||
path.setSegType(v);
|
||||
|
@ -2651,7 +2651,7 @@ export const pathActions = (function () {
|
|||
/**
|
||||
* @param {string} attr
|
||||
* @param {Float} newValue
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
moveNode (attr, newValue) {
|
||||
const selPts = path.selected_pts;
|
||||
|
@ -2669,7 +2669,7 @@ export const pathActions = (function () {
|
|||
},
|
||||
/**
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
fixEnd (elem) {
|
||||
// Adds an extra segment if the last seg before a Z doesn't end
|
||||
|
|
|
@ -36,13 +36,13 @@ let context_;
|
|||
/**
|
||||
* @function module:recalculate.EditorContext#setStartTransform
|
||||
* @param {string} transform
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @function module:recalculate.init
|
||||
* @param {module:recalculate.EditorContext} editorContext
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (editorContext) {
|
||||
context_ = editorContext;
|
||||
|
@ -54,7 +54,7 @@ export const init = function (editorContext) {
|
|||
* @param {string} attr - The clip-path attribute value with the clipPath's ID
|
||||
* @param {Float} tx - The translation's x value
|
||||
* @param {Float} ty - The translation's y value
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const updateClipPath = function (attr, tx, ty) {
|
||||
const path = getRefElem(attr).firstChild;
|
||||
|
|
|
@ -108,7 +108,7 @@ Object.entries(svgWhiteList_).forEach(function ([elt, atts]) {
|
|||
* It only keeps what is allowed from our whitelist defined above.
|
||||
* @function module:sanitize.sanitizeSvg
|
||||
* @param {Text|Element} node - The DOM element to be checked (we'll also check its children) or text node to be cleaned up
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const sanitizeSvg = function (node) {
|
||||
// Cleanup text nodes
|
||||
|
|
|
@ -79,7 +79,7 @@ export class Selector {
|
|||
* Used to reset the id and element that the selector is attached to.
|
||||
* @param {Element} e - DOM element associated with this selector
|
||||
* @param {module:utilities.BBoxObject} bbox - Optional bbox to use for reset (prevents duplicate getBBox call).
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
reset (e, bbox) {
|
||||
this.locked = true;
|
||||
|
@ -91,7 +91,7 @@ export class Selector {
|
|||
/**
|
||||
* Show the resize grips of this selector.
|
||||
* @param {boolean} show - Indicates whether grips should be shown or not
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
showGrips (show) {
|
||||
const bShow = show ? 'inline' : 'none';
|
||||
|
@ -107,7 +107,7 @@ export class Selector {
|
|||
/**
|
||||
* Updates the selector to match the element's size.
|
||||
* @param {module:utilities.BBoxObject} [bbox] - BBox to use for resize (prevents duplicate getBBox call).
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
resize (bbox) {
|
||||
const selectedBox = this.selectorRect,
|
||||
|
@ -240,7 +240,7 @@ export class Selector {
|
|||
/**
|
||||
* Updates cursors for corner grips on rotation so arrows point the right way.
|
||||
* @param {Float} angle - Current rotation angle in degrees
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
Selector.updateGripCursors = function (angle) {
|
||||
const dirArr = Object.keys(selectorManager_.selectorGrips);
|
||||
|
@ -293,7 +293,7 @@ export class SelectorManager {
|
|||
|
||||
/**
|
||||
* Resets the parent selector group element.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
initGroup () {
|
||||
// remove old selector parent group if it existed
|
||||
|
@ -439,7 +439,7 @@ export class SelectorManager {
|
|||
* Removes the selector of the given element (hides selection box).
|
||||
*
|
||||
* @param {Element} elem - DOM element to remove the selector for
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
releaseSelector (elem) {
|
||||
if (isNullish(elem)) { return; }
|
||||
|
@ -531,7 +531,7 @@ export class SelectorManager {
|
|||
* @function module:select.init
|
||||
* @param {module:select.Config} config - An object containing configurable parameters (imgPath)
|
||||
* @param {module:select.SVGFactory} svgFactory - An object implementing the SVGFactory interface.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (config, svgFactory) {
|
||||
config_ = config;
|
||||
|
|
|
@ -90,7 +90,7 @@ export default function jQueryPluginSpinButton ($) {
|
|||
/**
|
||||
* @callback module:jQuerySpinButton.ValueCallback
|
||||
* @param {external:jQuery.fn.SpinButton} thisArg Spin Button; check its `value` to see how it was changed.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @typedef {PlainObject} module:jQuerySpinButton.SpinButtonConfig
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -180,7 +180,7 @@ let svgcontent = svgdoc.createElementNS(NS.SVG, 'svg');
|
|||
/**
|
||||
* This function resets the svgcontent element while keeping it in the DOM.
|
||||
* @function module:svgcanvas.SvgCanvas#clearSvgContentElement
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const clearSvgContentElement = canvas.clearSvgContentElement = function () {
|
||||
$(svgcontent).empty();
|
||||
|
@ -211,7 +211,7 @@ let idprefix = 'svg_';
|
|||
* Changes the ID prefix to the given value.
|
||||
* @function module:svgcanvas.SvgCanvas#setIdPrefix
|
||||
* @param {string} p - String with the new prefix
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
canvas.setIdPrefix = function (p) {
|
||||
idprefix = p;
|
||||
|
@ -493,7 +493,7 @@ const undoMgr = canvas.undoMgr = new UndoManager({
|
|||
* @param {string} eventType One of the HistoryEvent types
|
||||
* @param {module:history.HistoryCommand} cmd Fulfills the HistoryCommand interface
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
handleHistoryEvent (eventType, cmd) {
|
||||
const EventTypes = HistoryEventTypes;
|
||||
|
@ -626,7 +626,7 @@ const getId = canvas.getId = function () {
|
|||
* @implements {module:draw.DrawCanvasInit#call|module:path.EditorContext#call}
|
||||
* @param {"selected"|"changed"|"contextset"|"pointsAdded"|"extension_added"|"extensions_added"|"message"|"transition"|"zoomed"|"updateCanvas"|"zoomDone"|"saved"|"exported"|"exportedPDF"|"setnonce"|"unsetnonce"|"cleared"} ev - String with the event name
|
||||
* @param {module:svgcanvas.SvgCanvas#event:GenericCanvasEvent} arg - Argument to pass through to the callback function.
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|undefined}
|
||||
* @returns {module:svgcanvas.EventHandlerReturn|void}
|
||||
*/
|
||||
const call = function (ev, arg) {
|
||||
if (events[ev]) {
|
||||
|
@ -843,7 +843,7 @@ pathModule.init(
|
|||
* @param {SVGCircleElement[]} ptsInfo.grips
|
||||
* @fires module:svgcanvas.SvgCanvas#event:pointsAdded
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
addPtsToSelection ({closedSubpath, grips}) {
|
||||
// TODO: Correct this:
|
||||
|
@ -857,7 +857,7 @@ pathModule.init(
|
|||
* @param {ChangeElementCommand} changes.cmd
|
||||
* @param {SVGPathElement} changes.elem
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
endChanges ({cmd, elem}) {
|
||||
addCommandToHistory(cmd);
|
||||
|
@ -1000,7 +1000,7 @@ this.runExtension = function (name, action, vars) {
|
|||
return this.runExtensions(action, vars, false, (n) => n === name);
|
||||
};
|
||||
/**
|
||||
* @typedef {module:svgcanvas.ExtensionMouseDownStatus|module:svgcanvas.ExtensionMouseUpStatus|module:svgcanvas.ExtensionIDsUpdatedStatus|module:locale.ExtensionLocaleData[]|undefined} module:svgcanvas.ExtensionStatus
|
||||
* @typedef {module:svgcanvas.ExtensionMouseDownStatus|module:svgcanvas.ExtensionMouseUpStatus|module:svgcanvas.ExtensionIDsUpdatedStatus|module:locale.ExtensionLocaleData[]|void} module:svgcanvas.ExtensionStatus
|
||||
* @tutorial ExtensionDocs
|
||||
*/
|
||||
/**
|
||||
|
@ -1067,12 +1067,12 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray,
|
|||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#mouseDown
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-mouseDown} arg
|
||||
* @returns {undefined|module:svgcanvas.ExtensionMouseDownStatus}
|
||||
* @returns {void|module:svgcanvas.ExtensionMouseDownStatus}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#mouseMove
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-mouseMove} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#mouseUp
|
||||
|
@ -1082,7 +1082,7 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray,
|
|||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#zoomChanged
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-zoomChanged} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#IDsUpdated
|
||||
|
@ -1092,37 +1092,37 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray,
|
|||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#canvasUpdated
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-canvasUpdated} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#toolButtonStateUpdate
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-toolButtonStateUpdate} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#selectedChanged
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-selectedChanged} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#elementTransition
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-elementTransition} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#elementChanged
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-elementChanged} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#langReady
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-langReady} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#langChanged
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-langChanged} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#addLangData
|
||||
|
@ -1132,18 +1132,18 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray,
|
|||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#onNewDocument
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-onNewDocument} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#workareaResized
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-workareaResized} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:svgcanvas.ExtensionInitResponse#callback
|
||||
* @this module:SVGEditor
|
||||
* @param {module:svgcanvas.SvgCanvas#event:ext-callback} arg
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1307,7 +1307,7 @@ const getVisibleElementsAndBBoxes = this.getVisibleElementsAndBBoxes = function
|
|||
* Wrap an SVG element into a group element, mark the group as 'gsvg'.
|
||||
* @function module:svgcanvas.SvgCanvas#groupSvgElem
|
||||
* @param {Element} elem - SVG element to wrap
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const groupSvgElem = this.groupSvgElem = function (elem) {
|
||||
const g = document.createElementNS(NS.SVG, 'g');
|
||||
|
@ -1375,11 +1375,11 @@ canvas.call = call;
|
|||
* [`init()`]{@link module:svgcanvas.ExtensionInitCallback}
|
||||
* along with the name of the extension.
|
||||
* @event module:svgcanvas.SvgCanvas#event:extension_added
|
||||
* @type {module:svgcanvas.ExtensionInitResponsePlusName|undefined}
|
||||
* @type {module:svgcanvas.ExtensionInitResponsePlusName|void}
|
||||
*/
|
||||
/**
|
||||
* @event module:svgcanvas.SvgCanvas#event:extensions_added
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
/**
|
||||
* @typedef {PlainObject} module:svgcanvas.Message
|
||||
|
@ -1401,15 +1401,15 @@ canvas.call = call;
|
|||
*/
|
||||
/**
|
||||
* @event module:svgcanvas.SvgCanvas#event:unsetnonce
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
/**
|
||||
* @event module:svgcanvas.SvgCanvas#event:zoomDone
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
/**
|
||||
* @event module:svgcanvas.SvgCanvas#event:cleared
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1424,7 +1424,7 @@ canvas.call = call;
|
|||
* Creating a cover-all class until {@link https://github.com/jsdoc3/jsdoc/issues/1545} may be supported.
|
||||
* `undefined` may be returned by {@link module:svgcanvas.SvgCanvas#event:extension_added} if the extension's `init` returns `undefined` It is also the type for the following events "zoomDone", "unsetnonce", "cleared", and "extensions_added".
|
||||
* @event module:svgcanvas.SvgCanvas#event:GenericCanvasEvent
|
||||
* @type {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset|module:svgcanvas.SvgCanvas#event:pointsAdded|module:svgcanvas.SvgCanvas#event:extension_added|module:svgcanvas.SvgCanvas#event:extensions_added|module:svgcanvas.SvgCanvas#event:message|module:svgcanvas.SvgCanvas#event:transition|module:svgcanvas.SvgCanvas#event:zoomed|module:svgcanvas.SvgCanvas#event:updateCanvas|module:svgcanvas.SvgCanvas#event:saved|module:svgcanvas.SvgCanvas#event:exported|module:svgcanvas.SvgCanvas#event:exportedPDF|module:svgcanvas.SvgCanvas#event:setnonce|module:svgcanvas.SvgCanvas#event:unsetnonce|undefined}
|
||||
* @type {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed|module:svgcanvas.SvgCanvas#event:contextset|module:svgcanvas.SvgCanvas#event:pointsAdded|module:svgcanvas.SvgCanvas#event:extension_added|module:svgcanvas.SvgCanvas#event:extensions_added|module:svgcanvas.SvgCanvas#event:message|module:svgcanvas.SvgCanvas#event:transition|module:svgcanvas.SvgCanvas#event:zoomed|module:svgcanvas.SvgCanvas#event:updateCanvas|module:svgcanvas.SvgCanvas#event:saved|module:svgcanvas.SvgCanvas#event:exported|module:svgcanvas.SvgCanvas#event:exportedPDF|module:svgcanvas.SvgCanvas#event:setnonce|module:svgcanvas.SvgCanvas#event:unsetnonce|void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1458,7 +1458,7 @@ canvas.bind = function (ev, f) {
|
|||
* Runs the SVG Document through the sanitizer and then updates its paths.
|
||||
* @function module:svgcanvas.SvgCanvas#prepareSvg
|
||||
* @param {XMLDocument} newDoc - The SVG DOM document
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.prepareSvg = function (newDoc) {
|
||||
this.sanitizeSvg(newDoc.documentElement);
|
||||
|
@ -1506,7 +1506,7 @@ const ffClone = function (elem) {
|
|||
* @param {string|Float} val - The new rotation angle in degrees
|
||||
* @param {boolean} preventUndo - Indicates whether the action should be undoable or not
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setRotationAngle = function (val, preventUndo) {
|
||||
// ensure val is the proper type
|
||||
|
@ -1560,7 +1560,7 @@ this.setRotationAngle = function (val, preventUndo) {
|
|||
* adding the changes to a single batch command.
|
||||
* @function module:svgcanvas.SvgCanvas#recalculateAllSelectedDimensions
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions = function () {
|
||||
const text = (currentResizeMode === 'none' ? 'position' : 'size');
|
||||
|
@ -1586,7 +1586,7 @@ const recalculateAllSelectedDimensions = this.recalculateAllSelectedDimensions =
|
|||
* Debug tool to easily see the current matrix in the browser's console.
|
||||
* @function module:svgcanvas~logMatrix
|
||||
* @param {SVGMatrix} m The matrix
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const logMatrix = function (m) {
|
||||
console.log([m.a, m.b, m.c, m.d, m.e, m.f]); // eslint-disable-line no-console
|
||||
|
@ -1606,7 +1606,7 @@ let rootSctm = null;
|
|||
* @function module:svgcanvas.SvgCanvas#selectOnly
|
||||
* @param {Element[]} elems - an array of DOM elements to be selected
|
||||
* @param {boolean} showGrips - Indicates whether the resize grips should be shown
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const selectOnly = this.selectOnly = function (elems, showGrips) {
|
||||
clearSelection(true);
|
||||
|
@ -1620,7 +1620,7 @@ const selectOnly = this.selectOnly = function (elems, showGrips) {
|
|||
* Removes elements from the selection.
|
||||
* @function module:svgcanvas.SvgCanvas#removeFromSelection
|
||||
* @param {Element[]} elemsToRemove - An array of elements to remove from selection
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/* const removeFromSelection = */ this.removeFromSelection = function (elemsToRemove) {
|
||||
if (isNullish(selectedElements[0])) { return; }
|
||||
|
@ -1647,7 +1647,7 @@ const selectOnly = this.selectOnly = function (elems, showGrips) {
|
|||
/**
|
||||
* Clears the selection, then adds all elements in the current layer to the selection.
|
||||
* @function module:svgcanvas.SvgCanvas#selectAllInCurrentLayer
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.selectAllInCurrentLayer = function () {
|
||||
const currentLayer = getCurrentDrawing().getCurrentLayer();
|
||||
|
@ -1728,7 +1728,7 @@ const getBsplinePoint = function (t) {
|
|||
* and do nothing else.
|
||||
* @param {MouseEvent} evt
|
||||
* @fires module:svgcanvas.SvgCanvas#event:ext-mouseDown
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const mouseDown = function (evt) {
|
||||
if (canvas.spaceKey || evt.button === 1) { return; }
|
||||
|
@ -2116,7 +2116,7 @@ const mouseDown = function (evt) {
|
|||
* @param {MouseEvent} evt
|
||||
* @fires module:svgcanvas.SvgCanvas#event:transition
|
||||
* @fires module:svgcanvas.SvgCanvas#event:ext-mouseMove
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const mouseMove = function (evt) {
|
||||
if (!started) { return; }
|
||||
|
@ -2566,7 +2566,7 @@ const mouseMove = function (evt) {
|
|||
* @fires module:svgcanvas.SvgCanvas#event:zoomed
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @fires module:svgcanvas.SvgCanvas#event:ext-mouseUp
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const mouseUp = function (evt) {
|
||||
if (evt.button === 2) { return; }
|
||||
|
@ -2953,7 +2953,7 @@ $(container).bind(
|
|||
* @param {Event} e
|
||||
* @fires module:svgcanvas.SvgCanvas#event:updateCanvas
|
||||
* @fires module:svgcanvas.SvgCanvas#event:zoomDone
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function (e) {
|
||||
if (!e.shiftKey) { return; }
|
||||
|
@ -3058,7 +3058,7 @@ let allowDbl;
|
|||
/**
|
||||
*
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setCursor (index) {
|
||||
const empty = (textinput.value === '');
|
||||
|
@ -3115,7 +3115,7 @@ function setCursor (index) {
|
|||
* @param {Integer} start
|
||||
* @param {Integer} end
|
||||
* @param {boolean} skipInput
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setSelection (start, end, skipInput) {
|
||||
if (start === end) {
|
||||
|
@ -3197,7 +3197,7 @@ function getIndexFromPoint (mouseX, mouseY) {
|
|||
*
|
||||
* @param {Float} mouseX
|
||||
* @param {Float} mouseY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setCursorFromPoint (mouseX, mouseY) {
|
||||
setCursor(getIndexFromPoint(mouseX, mouseY));
|
||||
|
@ -3208,7 +3208,7 @@ function setCursorFromPoint (mouseX, mouseY) {
|
|||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
* @param {boolean} apply
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setEndSelectionFromPoint (x, y, apply) {
|
||||
const i1 = textinput.selectionStart;
|
||||
|
@ -3279,7 +3279,7 @@ function hideCursor () {
|
|||
/**
|
||||
*
|
||||
* @param {Event} evt
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function selectAll (evt) {
|
||||
setSelection(0, curtext.textContent.length);
|
||||
|
@ -3289,7 +3289,7 @@ function selectAll (evt) {
|
|||
/**
|
||||
*
|
||||
* @param {Event} evt
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function selectWord (evt) {
|
||||
if (!allowDbl || !curtext) { return; }
|
||||
|
@ -3318,7 +3318,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
* @param {Element} target
|
||||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
select (target, x, y) {
|
||||
curtext = target;
|
||||
|
@ -3326,7 +3326,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
},
|
||||
/**
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
start (elem) {
|
||||
curtext = elem;
|
||||
|
@ -3337,7 +3337,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
* @param {Element} mouseTarget
|
||||
* @param {Float} startX
|
||||
* @param {Float} startY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mouseDown (evt, mouseTarget, startX, startY) {
|
||||
const pt = screenToPt(startX, startY);
|
||||
|
@ -3352,7 +3352,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
/**
|
||||
* @param {Float} mouseX
|
||||
* @param {Float} mouseY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mouseMove (mouseX, mouseY) {
|
||||
const pt = screenToPt(mouseX, mouseY);
|
||||
|
@ -3362,7 +3362,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
* @param {external:MouseEvent} evt
|
||||
* @param {Float} mouseX
|
||||
* @param {Float} mouseY
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
mouseUp (evt, mouseX, mouseY) {
|
||||
const pt = screenToPt(mouseX, mouseY);
|
||||
|
@ -3388,13 +3388,13 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
/**
|
||||
* @function
|
||||
* @param {Integer} index
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setCursor,
|
||||
/**
|
||||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
toEditMode (x, y) {
|
||||
allowDbl = false;
|
||||
|
@ -3427,7 +3427,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
/**
|
||||
* @param {boolean|Element} selectElem
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
toSelectMode (selectElem) {
|
||||
currentMode = 'select';
|
||||
|
@ -3459,14 +3459,14 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
},
|
||||
/**
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
setInputElem (elem) {
|
||||
textinput = elem;
|
||||
// $(textinput).blur(hideCursor);
|
||||
},
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clear () {
|
||||
if (currentMode === 'textedit') {
|
||||
|
@ -3475,7 +3475,7 @@ return /** @lends module:svgcanvas.SvgCanvas#textActions */ {
|
|||
},
|
||||
/**
|
||||
* @param {Element} inputElem Not in use
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
init (inputElem) {
|
||||
if (!curtext) { return; }
|
||||
|
@ -3835,7 +3835,7 @@ this.svgToString = function (elem, indent) {
|
|||
* Function to run when image data is found
|
||||
* @callback module:svgcanvas.ImageEmbeddedCallback
|
||||
* @param {string|false} result Data URL
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* Converts a given image file to a data URL when possible, then runs a given callback.
|
||||
|
@ -3876,7 +3876,7 @@ this.embedImage = function (src) {
|
|||
* Sets a given URL to be a "last good image" URL.
|
||||
* @function module:svgcanvas.SvgCanvas#setGoodImage
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setGoodImage = function (val) {
|
||||
lastGoodImgUrl = val;
|
||||
|
@ -3885,7 +3885,7 @@ this.setGoodImage = function (val) {
|
|||
/**
|
||||
* Does nothing by default, handled by optional widget/extension.
|
||||
* @function module:svgcanvas.SvgCanvas#open
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.open = function () {
|
||||
/* */
|
||||
|
@ -3898,7 +3898,7 @@ this.open = function () {
|
|||
* @function module:svgcanvas.SvgCanvas#save
|
||||
* @param {module:svgcanvas.SaveOptions} opts
|
||||
* @fires module:svgcanvas.SvgCanvas#event:saved
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.save = function (opts) {
|
||||
// remove the selected outline before serializing
|
||||
|
@ -4011,7 +4011,7 @@ this.rasterExport = async function (imgType, quality, exportWindowName, opts = {
|
|||
let bloburl;
|
||||
/**
|
||||
* Called when `bloburl` is available for export.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function done () {
|
||||
const obj = {
|
||||
|
@ -4038,7 +4038,7 @@ this.rasterExport = async function (imgType, quality, exportWindowName, opts = {
|
|||
* @external jsPDF
|
||||
*/
|
||||
/**
|
||||
* @typedef {undefined|"save"|"arraybuffer"|"blob"|"datauristring"|"dataurlstring"|"dataurlnewwindow"|"datauri"|"dataurl"} external:jsPDF.OutputType
|
||||
* @typedef {void|"save"|"arraybuffer"|"blob"|"datauristring"|"dataurlstring"|"dataurlnewwindow"|"datauri"|"dataurl"} external:jsPDF.OutputType
|
||||
* @todo Newer version to add also allows these `outputType` values "bloburi"|"bloburl" which return strings, so document here and for `outputType` of `module:svgcanvas.PDFExportedResults` below if added
|
||||
*/
|
||||
/**
|
||||
|
@ -4146,7 +4146,7 @@ this.getSvgString = function () {
|
|||
* @function module:svgcanvas.SvgCanvas#randomizeIds
|
||||
* @param {boolean} [enableRandomization] If true, adds a nonce to the prefix. Thus
|
||||
* `svgCanvas.randomizeIds() <==> svgCanvas.randomizeIds(true)`
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.randomizeIds = function (enableRandomization) {
|
||||
if (arguments.length > 0 && enableRandomization === false) {
|
||||
|
@ -4160,7 +4160,7 @@ this.randomizeIds = function (enableRandomization) {
|
|||
* Ensure each element has a unique ID.
|
||||
* @function module:svgcanvas.SvgCanvas#uniquifyElems
|
||||
* @param {Element} g - The parent element of the tree to give unique IDs
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const uniquifyElems = this.uniquifyElems = function (g) {
|
||||
const ids = {};
|
||||
|
@ -4254,7 +4254,7 @@ const uniquifyElems = this.uniquifyElems = function (g) {
|
|||
* Assigns reference data for each use element.
|
||||
* @function module:svgcanvas.SvgCanvas#setUseData
|
||||
* @param {Element} parent
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const setUseData = this.setUseData = function (parent) {
|
||||
let elems = $(parent);
|
||||
|
@ -4278,7 +4278,7 @@ const setUseData = this.setUseData = function (parent) {
|
|||
* Converts gradients from userSpaceOnUse to objectBoundingBox.
|
||||
* @function module:svgcanvas.SvgCanvas#convertGradients
|
||||
* @param {Element} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const convertGradients = this.convertGradients = function (elem) {
|
||||
let elems = $(elem).find('linearGradient, radialGradient');
|
||||
|
@ -4357,7 +4357,7 @@ const convertGradients = this.convertGradients = function (elem) {
|
|||
* @function module:svgcanvas.SvgCanvas#convertToGroup
|
||||
* @param {Element} elem
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const convertToGroup = this.convertToGroup = function (elem) {
|
||||
if (!elem) {
|
||||
|
@ -4826,7 +4826,7 @@ draw.init(
|
|||
addCommandToHistory,
|
||||
/**
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
changeSVGContent () {
|
||||
call('changed', [svgcontent]);
|
||||
|
@ -4842,7 +4842,7 @@ draw.init(
|
|||
* Clears the current document. This is not an undoable action.
|
||||
* @function module:svgcanvas.SvgCanvas#clear
|
||||
* @fires module:svgcanvas.SvgCanvas#event:cleared
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.clear = function () {
|
||||
pathActions.clear();
|
||||
|
@ -4928,7 +4928,7 @@ this.getVersion = function () {
|
|||
* Update interface strings with given values.
|
||||
* @function module:svgcanvas.SvgCanvas#setUiStrings
|
||||
* @param {module:path.uiStrings} strs - Object with strings (see the [locales API]{@link module:locale.LocaleStrings} and the [tutorial]{@tutorial LocaleDocs})
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setUiStrings = function (strs) {
|
||||
Object.assign(uiStrings, strs.notification);
|
||||
|
@ -4940,7 +4940,7 @@ this.setUiStrings = function (strs) {
|
|||
* Update configuration options with given values.
|
||||
* @function module:svgcanvas.SvgCanvas#setConfig
|
||||
* @param {module:SVGEditor.Config} opts - Object with options
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setConfig = function (opts) {
|
||||
Object.assign(curConfig, opts);
|
||||
|
@ -4949,7 +4949,7 @@ this.setConfig = function (opts) {
|
|||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getTitle
|
||||
* @param {Element} [elem]
|
||||
* @returns {string|undefined} the current group/SVG's title contents or
|
||||
* @returns {string|void} the current group/SVG's title contents or
|
||||
* `undefined` if no element is passed nd there are no selected elements.
|
||||
*/
|
||||
this.getTitle = function (elem) {
|
||||
|
@ -4970,7 +4970,7 @@ this.getTitle = function (elem) {
|
|||
* @function module:svgcanvas.SvgCanvas#setGroupTitle
|
||||
* @param {string} val
|
||||
* @todo Combine this with `setDocumentTitle`
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setGroupTitle = function (val) {
|
||||
let elem = selectedElements[0];
|
||||
|
@ -5004,7 +5004,7 @@ this.setGroupTitle = function (val) {
|
|||
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getDocumentTitle
|
||||
* @returns {string|undefined} The current document title or an empty string if not found
|
||||
* @returns {string|void} The current document title or an empty string if not found
|
||||
*/
|
||||
const getDocumentTitle = this.getDocumentTitle = function () {
|
||||
return canvas.getTitle(svgcontent);
|
||||
|
@ -5015,7 +5015,7 @@ const getDocumentTitle = this.getDocumentTitle = function () {
|
|||
* This is an undoable action.
|
||||
* @function module:svgcanvas.SvgCanvas#setDocumentTitle
|
||||
* @param {string} newTitle - String with the new title
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setDocumentTitle = function (newTitle) {
|
||||
const childs = svgcontent.childNodes;
|
||||
|
@ -5148,7 +5148,7 @@ this.getOffset = function () {
|
|||
* @param {"selection"|"canvas"|"content"|"layer"|module:SVGEditor.BBoxObjectWithFactor} val - Bounding box object to zoom to or string indicating zoom option. Note: the object value type is defined in `svg-editor.js`
|
||||
* @param {Integer} editorW - The editor's workarea box's width
|
||||
* @param {Integer} editorH - The editor's workarea box's height
|
||||
* @returns {module:svgcanvas.ZoomAndBBox|undefined}
|
||||
* @returns {module:svgcanvas.ZoomAndBBox|void}
|
||||
*/
|
||||
this.setBBoxZoom = function (val, editorW, editorH) {
|
||||
let spacer = 0.85;
|
||||
|
@ -5256,18 +5256,18 @@ this.setBBoxZoom = function (val, editorW, editorH) {
|
|||
/**
|
||||
* Called when new image is created
|
||||
* @event module:svgcanvas.SvgCanvas#event:ext-onNewDocument
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
/**
|
||||
* Called when sidepanel is resized or toggled
|
||||
* @event module:svgcanvas.SvgCanvas#event:ext-workareaResized
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
/**
|
||||
* Called upon addition of the extension, or, if svgicons are set,
|
||||
* after the icons are ready when extension SVG icons have loaded.
|
||||
* @event module:svgcanvas.SvgCanvas#event:ext-callback
|
||||
* @type {undefined}
|
||||
* @type {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -5275,7 +5275,7 @@ this.setBBoxZoom = function (val, editorW, editorH) {
|
|||
* @function module:svgcanvas.SvgCanvas#setZoom
|
||||
* @param {Float} zoomLevel - Float indicating the zoom level to change to
|
||||
* @fires module:svgcanvas.SvgCanvas#event:ext-zoomChanged
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setZoom = function (zoomLevel) {
|
||||
const res = getResolution();
|
||||
|
@ -5301,7 +5301,7 @@ this.getMode = function () {
|
|||
* Sets the editor's mode to the given string.
|
||||
* @function module:svgcanvas.SvgCanvas#setMode
|
||||
* @param {string} name - String with the new mode to change to
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setMode = function (name) {
|
||||
pathActions.clear(true);
|
||||
|
@ -5335,7 +5335,7 @@ this.getColor = function (type) {
|
|||
* @param {string} val - The value to set the stroke attribute to
|
||||
* @param {boolean} preventUndo - Boolean indicating whether or not this should be an undoable option
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setColor = function (type, val, preventUndo) {
|
||||
curShape[type] = val;
|
||||
|
@ -5344,7 +5344,7 @@ this.setColor = function (type, val, preventUndo) {
|
|||
/**
|
||||
*
|
||||
* @param {Element} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addNonG (e) {
|
||||
if (e.nodeName !== 'g') {
|
||||
|
@ -5380,7 +5380,7 @@ this.setColor = function (type, val, preventUndo) {
|
|||
* Apply the current gradient to selected element's fill or stroke.
|
||||
* @function module:svgcanvas.SvgCanvas#setGradient
|
||||
* @param {"fill"|"stroke"} type - String indicating "fill" or "stroke" to apply to an element
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const setGradient = this.setGradient = function (type) {
|
||||
if (!curProperties[type + '_paint'] || curProperties[type + '_paint'].type === 'solidColor') { return; }
|
||||
|
@ -5466,7 +5466,7 @@ const findDuplicateGradient = function (grad) {
|
|||
* @function module:svgcanvas.SvgCanvas#setPaint
|
||||
* @param {"fill"|"stroke"} type - String with "fill" or "stroke"
|
||||
* @param {module:jGraduate.jGraduatePaintOptions} paint - The jGraduate paint object to apply
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setPaint = function (type, paint) {
|
||||
// make a copy
|
||||
|
@ -5490,7 +5490,7 @@ this.setPaint = function (type, paint) {
|
|||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#setStrokePaint
|
||||
* @param {module:jGraduate~Paint} paint
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setStrokePaint = function (paint) {
|
||||
this.setPaint('stroke', paint);
|
||||
|
@ -5499,7 +5499,7 @@ this.setStrokePaint = function (paint) {
|
|||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#setFillPaint
|
||||
* @param {module:jGraduate~Paint} paint
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setFillPaint = function (paint) {
|
||||
this.setPaint('fill', paint);
|
||||
|
@ -5519,7 +5519,7 @@ this.getStrokeWidth = function () {
|
|||
* @function module:svgcanvas.SvgCanvas#setStrokeWidth
|
||||
* @param {Float} val - A Float indicating the new stroke width value
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setStrokeWidth = function (val) {
|
||||
if (val === 0 && ['line', 'path'].includes(currentMode)) {
|
||||
|
@ -5532,7 +5532,7 @@ this.setStrokeWidth = function (val) {
|
|||
/**
|
||||
*
|
||||
* @param {Element} e
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addNonG (e) {
|
||||
if (e.nodeName !== 'g') {
|
||||
|
@ -5562,7 +5562,7 @@ this.setStrokeWidth = function (val) {
|
|||
* @param {string} attr - String with the attribute name
|
||||
* @param {string|Float} val - String or number with the attribute value
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setStrokeAttr = function (attr, val) {
|
||||
curShape[attr.replace('-', '_')] = val;
|
||||
|
@ -5616,7 +5616,7 @@ this.getOpacity = getOpacity;
|
|||
* Sets the given opacity on the current selected elements.
|
||||
* @function module:svgcanvas.SvgCanvas#setOpacity
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setOpacity = function (val) {
|
||||
curShape.opacity = val;
|
||||
|
@ -5645,7 +5645,7 @@ this.getStrokeOpacity = function () {
|
|||
* @param {string} type - String with "fill" or "stroke"
|
||||
* @param {Float} val - Float with the new opacity value
|
||||
* @param {boolean} preventUndo - Indicates whether or not this should be an undoable action
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setPaintOpacity = function (type, val, preventUndo) {
|
||||
curShape[type + '_opacity'] = val;
|
||||
|
@ -5697,7 +5697,7 @@ let filterHidden = false;
|
|||
* Sets the `stdDeviation` blur value on the selected element without being undoable.
|
||||
* @function module:svgcanvas.SvgCanvas#setBlurNoUndo
|
||||
* @param {Float} val - The new `stdDeviation` value
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
canvas.setBlurNoUndo = function (val) {
|
||||
if (!filter) {
|
||||
|
@ -5726,7 +5726,7 @@ canvas.setBlurNoUndo = function (val) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function finishChange () {
|
||||
const bCmd = canvas.undoMgr.finishUndoableChange();
|
||||
|
@ -5742,7 +5742,7 @@ function finishChange () {
|
|||
* @function module:svgcanvas.SvgCanvas#setBlurOffsets
|
||||
* @param {Element} filterElem - The filter DOM element to update
|
||||
* @param {Float} stdDev - The standard deviation value on which to base the offset size
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
canvas.setBlurOffsets = function (filterElem, stdDev) {
|
||||
if (stdDev > 3) {
|
||||
|
@ -5767,7 +5767,7 @@ canvas.setBlurOffsets = function (filterElem, stdDev) {
|
|||
* @function module:svgcanvas.SvgCanvas#setBlur
|
||||
* @param {Float} val - Float with the new `stdDeviation` blur value
|
||||
* @param {boolean} complete - Whether or not the action should be completed (to add to the undo manager)
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
canvas.setBlur = function (val, complete) {
|
||||
if (curCommand) {
|
||||
|
@ -5850,7 +5850,7 @@ this.getBold = function () {
|
|||
* Make the selected element bold or normal.
|
||||
* @function module:svgcanvas.SvgCanvas#setBold
|
||||
* @param {boolean} b - Indicates bold (`true`) or normal (`false`)
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setBold = function (b) {
|
||||
const selected = selectedElements[0];
|
||||
|
@ -5881,7 +5881,7 @@ this.getItalic = function () {
|
|||
* Make the selected element italic or normal.
|
||||
* @function module:svgcanvas.SvgCanvas#setItalic
|
||||
* @param {boolean} i - Indicates italic (`true`) or normal (`false`)
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setItalic = function (i) {
|
||||
const selected = selectedElements[0];
|
||||
|
@ -5906,7 +5906,7 @@ this.getFontFamily = function () {
|
|||
* Set the new font family.
|
||||
* @function module:svgcanvas.SvgCanvas#setFontFamily
|
||||
* @param {string} val - String with the new font family
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setFontFamily = function (val) {
|
||||
curText.font_family = val;
|
||||
|
@ -5920,7 +5920,7 @@ this.setFontFamily = function (val) {
|
|||
* Set the new font color.
|
||||
* @function module:svgcanvas.SvgCanvas#setFontColor
|
||||
* @param {string} val - String with the new font color
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setFontColor = function (val) {
|
||||
curText.fill = val;
|
||||
|
@ -5947,7 +5947,7 @@ this.getFontSize = function () {
|
|||
* Applies the given font size to the selected element.
|
||||
* @function module:svgcanvas.SvgCanvas#setFontSize
|
||||
* @param {Float} val - Float with the new font size
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setFontSize = function (val) {
|
||||
curText.font_size = val;
|
||||
|
@ -5971,7 +5971,7 @@ this.getText = function () {
|
|||
* Updates the text element with the given string.
|
||||
* @function module:svgcanvas.SvgCanvas#setTextContent
|
||||
* @param {string} val - String with the new text
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setTextContent = function (val) {
|
||||
changeSelectedAttribute('#text', val);
|
||||
|
@ -5985,7 +5985,7 @@ this.setTextContent = function (val) {
|
|||
* @function module:svgcanvas.SvgCanvas#setImageURL
|
||||
* @param {string} val - String with the image URL/path
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setImageURL = function (val) {
|
||||
const elem = selectedElements[0];
|
||||
|
@ -6028,7 +6028,7 @@ this.setImageURL = function (val) {
|
|||
* Sets the new link URL for the selected anchor element.
|
||||
* @function module:svgcanvas.SvgCanvas#setLinkURL
|
||||
* @param {string} val - String with the link URL/path
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setLinkURL = function (val) {
|
||||
let elem = selectedElements[0];
|
||||
|
@ -6063,7 +6063,7 @@ this.setLinkURL = function (val) {
|
|||
* @function module:svgcanvas.SvgCanvas#setRectRadius
|
||||
* @param {string|Float} val - The new radius
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setRectRadius = function (val) {
|
||||
const selected = selectedElements[0];
|
||||
|
@ -6082,7 +6082,7 @@ this.setRectRadius = function (val) {
|
|||
* Wraps the selected element(s) in an anchor element or converts group to one.
|
||||
* @function module:svgcanvas.SvgCanvas#makeHyperlink
|
||||
* @param {string} url
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.makeHyperlink = function (url) {
|
||||
canvas.groupSelectedElements('a', url);
|
||||
|
@ -6093,7 +6093,7 @@ this.makeHyperlink = function (url) {
|
|||
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#removeHyperlink
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.removeHyperlink = function () {
|
||||
canvas.ungroupSelectedElement();
|
||||
|
@ -6107,7 +6107,7 @@ this.removeHyperlink = function () {
|
|||
* Sets the new segment type to the selected segment(s).
|
||||
* @function module:svgcanvas.SvgCanvas#setSegType
|
||||
* @param {Integer} newType - New segment type. See {@link https://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathSeg} for list
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setSegType = function (newType) {
|
||||
pathActions.setSegType(newType);
|
||||
|
@ -6119,7 +6119,7 @@ this.setSegType = function (newType) {
|
|||
* @todo (codedread): Remove the getBBox argument and split this function into two.
|
||||
* @param {Element} elem - The DOM element to be converted
|
||||
* @param {boolean} getBBox - Boolean on whether or not to only return the path's BBox
|
||||
* @returns {undefined|DOMRect|false|SVGPathElement|null} If the getBBox flag is true, the resulting path's bounding box object.
|
||||
* @returns {void|DOMRect|false|SVGPathElement|null} If the getBBox flag is true, the resulting path's bounding box object.
|
||||
* Otherwise the resulting path element is returned.
|
||||
*/
|
||||
this.convertToPath = function (elem, getBBox) {
|
||||
|
@ -6156,7 +6156,7 @@ this.convertToPath = function (elem, getBBox) {
|
|||
* @param {string} attr - Attribute name
|
||||
* @param {string|Float} newValue - String or number with the new attribute value
|
||||
* @param {Element[]} elems - The DOM elements to apply the change to
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const changeSelectedAttributeNoUndo = function (attr, newValue, elems) {
|
||||
if (currentMode === 'pathedit') {
|
||||
|
@ -6280,7 +6280,7 @@ const changeSelectedAttributeNoUndo = function (attr, newValue, elems) {
|
|||
* @param {string} attr - String with the attribute name
|
||||
* @param {string|Float} val - String or number with the new attribute value
|
||||
* @param {Element[]} elems - The DOM elements to apply the change to
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
const changeSelectedAttribute = this.changeSelectedAttribute = function (attr, val, elems) {
|
||||
elems = elems || selectedElements;
|
||||
|
@ -6300,7 +6300,7 @@ const changeSelectedAttribute = this.changeSelectedAttribute = function (attr, v
|
|||
* history stack.
|
||||
* @function module:svgcanvas.SvgCanvas#deleteSelectedElements
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.deleteSelectedElements = function () {
|
||||
const batchCmd = new BatchCommand('Delete Elements');
|
||||
|
@ -6342,7 +6342,7 @@ this.deleteSelectedElements = function () {
|
|||
* Removes all selected elements from the DOM and adds the change to the
|
||||
* history stack. Remembers removed elements on the clipboard.
|
||||
* @function module:svgcanvas.SvgCanvas#cutSelectedElements
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.cutSelectedElements = function () {
|
||||
canvas.copySelectedElements();
|
||||
|
@ -6352,7 +6352,7 @@ this.cutSelectedElements = function () {
|
|||
/**
|
||||
* Remembers the current selected elements on the clipboard.
|
||||
* @function module:svgcanvas.SvgCanvas#copySelectedElements
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.copySelectedElements = function () {
|
||||
localStorage.setItem('svgedit_clipboard', JSON.stringify(
|
||||
|
@ -6364,12 +6364,12 @@ this.copySelectedElements = function () {
|
|||
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#pasteElements
|
||||
* @param {"in_place"|"point"|undefined} type
|
||||
* @param {Integer|undefined} x Expected if type is "point"
|
||||
* @param {Integer|undefined} y Expected if type is "point"
|
||||
* @param {"in_place"|"point"|void} type
|
||||
* @param {Integer|void} x Expected if type is "point"
|
||||
* @param {Integer|void} y Expected if type is "point"
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @fires module:svgcanvas.SvgCanvas#event:ext-IDsUpdated
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.pasteElements = function (type, x, y) {
|
||||
let clipb = JSON.parse(localStorage.getItem('svgedit_clipboard'));
|
||||
|
@ -6391,7 +6391,7 @@ this.pasteElements = function (type, x, y) {
|
|||
/**
|
||||
*
|
||||
* @param {module:svgcanvas.SVGAsJSON} elem
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkIDs (elem) {
|
||||
if (elem.attr && elem.attr.id) {
|
||||
|
@ -6474,7 +6474,7 @@ this.pasteElements = function (type, x, y) {
|
|||
* @function module:svgcanvas.SvgCanvas#groupSelectedElements
|
||||
* @param {"a"|"g"} [type="g"] - type of element to group into, defaults to `<g>`
|
||||
* @param {string} [urlArg]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.groupSelectedElements = function (type, urlArg) {
|
||||
if (!type) { type = 'g'; }
|
||||
|
@ -6534,7 +6534,7 @@ this.groupSelectedElements = function (type, urlArg) {
|
|||
* @function module:svgcanvas.SvgCanvas#pushGroupProperties
|
||||
* @param {SVGAElement|SVGGElement} g
|
||||
* @param {boolean} undoable
|
||||
* @returns {BatchCommand|undefined}
|
||||
* @returns {BatchCommand|void}
|
||||
*/
|
||||
const pushGroupProperties = this.pushGroupProperties = function (g, undoable) {
|
||||
const children = g.childNodes;
|
||||
|
@ -6720,7 +6720,7 @@ const pushGroupProperties = this.pushGroupProperties = function (g, undoable) {
|
|||
* Unwraps all the elements in a selected group (`g`) element. This requires
|
||||
* significant recalculations to apply group's transforms, etc. to its children.
|
||||
* @function module:svgcanvas.SvgCanvas#ungroupSelectedElement
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.ungroupSelectedElement = function () {
|
||||
let g = selectedElements[0];
|
||||
|
@ -6792,7 +6792,7 @@ this.ungroupSelectedElement = function () {
|
|||
* other elements.
|
||||
* @function module:svgcanvas.SvgCanvas#moveToTopSelectedElement
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.moveToTopSelectedElement = function () {
|
||||
const [selected] = selectedElements;
|
||||
|
@ -6815,7 +6815,7 @@ this.moveToTopSelectedElement = function () {
|
|||
* other elements.
|
||||
* @function module:svgcanvas.SvgCanvas#moveToBottomSelectedElement
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.moveToBottomSelectedElement = function () {
|
||||
const [selected] = selectedElements;
|
||||
|
@ -6848,7 +6848,7 @@ this.moveToBottomSelectedElement = function () {
|
|||
* @function module:svgcanvas.SvgCanvas#moveUpDownSelected
|
||||
* @param {"Up"|"Down"} dir - String that's either 'Up' or 'Down'
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.moveUpDownSelected = function (dir) {
|
||||
const selected = selectedElements[0];
|
||||
|
@ -6891,7 +6891,7 @@ this.moveUpDownSelected = function (dir) {
|
|||
* @param {Float} dy - Float with the distance to move on the y-axis
|
||||
* @param {boolean} undoable - Boolean indicating whether or not the action should be undoable
|
||||
* @fires module:svgcanvas.SvgCanvas#event:changed
|
||||
* @returns {BatchCommand|undefined} Batch command for the move
|
||||
* @returns {BatchCommand|void} Batch command for the move
|
||||
*/
|
||||
this.moveSelectedElements = function (dx, dy, undoable) {
|
||||
// if undoable is not sent, default to true
|
||||
|
@ -6961,7 +6961,7 @@ this.moveSelectedElements = function (dx, dy, undoable) {
|
|||
* @function module:svgcanvas.SvgCanvas#cloneSelectedElements
|
||||
* @param {Float} x Float with the distance to move on the x-axis
|
||||
* @param {Float} y Float with the distance to move on the y-axis
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.cloneSelectedElements = function (x, y) {
|
||||
let i, elem;
|
||||
|
@ -7008,7 +7008,7 @@ this.cloneSelectedElements = function (x, y) {
|
|||
* @function module:svgcanvas.SvgCanvas#alignSelectedElements
|
||||
* @param {string} type - String with single character indicating the alignment type
|
||||
* @param {"selected"|"largest"|"smallest"|"page"} relativeTo
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.alignSelectedElements = function (type, relativeTo) {
|
||||
const bboxes = []; // angles = [];
|
||||
|
@ -7193,7 +7193,7 @@ this.updateCanvas = function (w, h) {
|
|||
* @function module:svgcanvas.SvgCanvas#setBackground
|
||||
* @param {string} color - String with fill color to apply
|
||||
* @param {string} url - URL or path to image to use
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.setBackground = function (color, url) {
|
||||
const bg = getElem('canvasBackground');
|
||||
|
@ -7223,7 +7223,7 @@ this.setBackground = function (color, url) {
|
|||
* @function module:svgcanvas.SvgCanvas#cycleElement
|
||||
* @param {boolean} next - true = next and false = previous element
|
||||
* @fires module:svgcanvas.SvgCanvas#event:selected
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
this.cycleElement = function (next) {
|
||||
let num;
|
||||
|
|
|
@ -143,7 +143,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
* the `alt` text
|
||||
* @param {string} [opts.testIconAlt="icon"] Alt text for the injected test image.
|
||||
* In case wish to ensure have one for accessibility
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
$.svgIcons = function (file, opts = {}) {
|
||||
const svgns = 'http://www.w3.org/2000/svg',
|
||||
|
@ -208,9 +208,9 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {"ajax"|0|undefined} evt
|
||||
* @param {"ajax"|0|void} evt
|
||||
* @param {boolean} [noWait]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function getIcons (evt, noWait) {
|
||||
if (evt !== 'ajax') {
|
||||
|
@ -263,7 +263,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
* @param {external:jQuery} icon A wrapped `defs` or Image
|
||||
* @param {string} id SVG icon ID
|
||||
* @param {boolean} setID Whether to set the ID attribute (with `id`)
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setIcon (target, icon, id, setID) {
|
||||
if (isOpera) icon.css('visibility', 'hidden');
|
||||
|
@ -293,7 +293,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
/**
|
||||
* @param {external:jQuery} icon A wrapped `defs` or Image
|
||||
* @param {string} id SVG icon ID
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function addIcon (icon, id) {
|
||||
if (opts.id_match === undefined || opts.id_match !== false) {
|
||||
|
@ -306,7 +306,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
*
|
||||
* @param {boolean} [toImage]
|
||||
* @param {external:jQuery.svgIcons.Fallback} [fallback]
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function makeIcons (toImage = false, fallback) {
|
||||
if (iconsMade) return;
|
||||
|
@ -473,7 +473,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function useFallback () {
|
||||
if (file.includes('.svgz')) {
|
||||
|
@ -519,7 +519,7 @@ export default function jQueryPluginSVGIcons ($) {
|
|||
* @function external:jQuery.resizeSvgIcons
|
||||
* @param {PlainObject.<string, module:jQuerySVGIcons.Size>} obj Object with
|
||||
* selectors as keys. The values are sizes.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
$.resizeSvgIcons = function (obj) {
|
||||
// FF2 and older don't detect .svg_icon, so we change it detect svg elems instead
|
||||
|
|
|
@ -61,7 +61,7 @@ let listMap_ = {};
|
|||
*/
|
||||
/**
|
||||
* @function module:SVGTransformList.SVGEditTransformList#clear
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
/**
|
||||
* @function module:SVGTransformList.SVGEditTransformList#initialize
|
||||
|
@ -199,7 +199,7 @@ export class SVGTransformList {// eslint-disable-line no-shadow
|
|||
this.numberOfItems = 0;
|
||||
}
|
||||
/**
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
clear () {
|
||||
this.numberOfItems = 0;
|
||||
|
@ -318,7 +318,7 @@ export class SVGTransformList {// eslint-disable-line no-shadow
|
|||
|
||||
/**
|
||||
* @function module:SVGTransformList.resetListMap
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const resetListMap = function () {
|
||||
listMap_ = {};
|
||||
|
@ -328,7 +328,7 @@ export const resetListMap = function () {
|
|||
* Removes transforms of the given element from the map.
|
||||
* @function module:SVGTransformList.removeElementFromListMap
|
||||
* @param {Element} elem - a DOM Element
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export let removeElementFromListMap = function (elem) { // eslint-disable-line import/no-mutable-exports
|
||||
if (elem.id && listMap_[elem.id]) {
|
||||
|
@ -375,7 +375,7 @@ export const getTransformList = function (elem) {
|
|||
* Replace `removeElementFromListMap` for unit-testing.
|
||||
* @function module:SVGTransformList.changeRemoveElementFromListMap
|
||||
* @param {module:SVGTransformList.removeElementFromListMap} cb Passed a single argument `elem`
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
export const changeRemoveElementFromListMap = function (cb) { // eslint-disable-line promise/prefer-await-to-callbacks
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
*
|
||||
* @param {Event} ev
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function touchHandler (ev) {
|
||||
const {changedTouches} = ev,
|
||||
|
|
|
@ -74,7 +74,7 @@ let typeMap_ = {};
|
|||
*
|
||||
* @function module:units.init
|
||||
* @param {module:units.ElementContainer} elementContainer - An object implementing the ElementContainer interface.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (elementContainer) {
|
||||
elementContainer_ = elementContainer;
|
||||
|
@ -165,7 +165,7 @@ export const convertUnit = function (val, unit) {
|
|||
* @param {Element} elem - DOM element to be changed
|
||||
* @param {string} attr - Name of the attribute associated with the value
|
||||
* @param {string} val - Attribute value to convert
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const setUnitAttr = function (elem, attr, val) {
|
||||
// if (!isNaN(val)) {
|
||||
|
@ -217,7 +217,7 @@ const attrsToConvert = {
|
|||
* Converts all applicable attributes to the configured baseUnit.
|
||||
* @function module:units.convertAttrs
|
||||
* @param {Element} element - A DOM element whose attributes should be converted
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const convertAttrs = function (element) {
|
||||
const elName = element.tagName;
|
||||
|
|
|
@ -93,7 +93,7 @@ let svgroot_ = null;
|
|||
/**
|
||||
* @function module:utilities.init
|
||||
* @param {module:utilities.EditorContext} editorContext
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const init = function (editorContext) {
|
||||
editorContext_ = editorContext;
|
||||
|
@ -371,7 +371,7 @@ export const bboxToObj = function ({x, y, width, height}) {
|
|||
/**
|
||||
* @callback module:utilities.TreeWalker
|
||||
* @param {Element} elem - DOM element being traversed
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -379,7 +379,7 @@ export const bboxToObj = function ({x, y, width, height}) {
|
|||
* @function module:utilities.walkTree
|
||||
* @param {Element} elem - DOM element to traverse
|
||||
* @param {module:utilities.TreeWalker} cbFn - Callback function to run on each element
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const walkTree = function (elem, cbFn) {
|
||||
if (elem && elem.nodeType === 1) {
|
||||
|
@ -397,7 +397,7 @@ export const walkTree = function (elem, cbFn) {
|
|||
* @todo FIXME: Shouldn't this be calling walkTreePost?
|
||||
* @param {Element} elem - DOM element to traverse
|
||||
* @param {module:utilities.TreeWalker} cbFn - Callback function to run on each element
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const walkTreePost = function (elem, cbFn) {
|
||||
if (elem && elem.nodeType === 1) {
|
||||
|
@ -450,7 +450,7 @@ export let getHref = function (elem) { // eslint-disable-line import/no-mutable-
|
|||
* @function module:utilities.setHref
|
||||
* @param {Element} elem
|
||||
* @param {string} val
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export let setHref = function (elem, val) { // eslint-disable-line import/no-mutable-exports
|
||||
elem.setAttributeNS(NS.XLINK, 'xlink:href', val);
|
||||
|
@ -1222,7 +1222,7 @@ export const getElem = (supportsSelectors())
|
|||
* @param {PlainObject.<string, string>} attrs - Object with attribute keys/values
|
||||
* @param {Integer} [suspendLength] - Milliseconds to suspend redraw
|
||||
* @param {boolean} [unitCheck=false] - Boolean to indicate the need to use units.setUnitAttr
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const assignAttributes = function (elem, attrs, suspendLength, unitCheck) {
|
||||
for (const [key, value] of Object.entries(attrs)) {
|
||||
|
@ -1244,7 +1244,7 @@ export const assignAttributes = function (elem, attrs, suspendLength, unitCheck)
|
|||
* Remove unneeded (default) attributes, making resulting SVG smaller.
|
||||
* @function module:utilities.cleanupElement
|
||||
* @param {Element} element - DOM element to clean up
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const cleanupElement = function (element) {
|
||||
const defaults = {
|
||||
|
@ -1305,7 +1305,7 @@ export const regexEscape = function (str) {
|
|||
* Prevents default browser click behaviour on the given element.
|
||||
* @function module:utilities.preventClickDefault
|
||||
* @param {Element} img - The DOM element to prevent the click on
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const preventClickDefault = function (img) {
|
||||
$(img).click(function (e) { e.preventDefault(); });
|
||||
|
@ -1380,7 +1380,7 @@ export const isNullish = (val) => {
|
|||
* Overwrite methods for unit testing.
|
||||
* @function module:utilities.mock
|
||||
* @param {PlainObject} mockMethods
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export const mock = ({
|
||||
getHref: getHrefUser, setHref: setHrefUser, getRotationAngle: getRotationAngleUser
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Opens the dialog with the SVG Editor.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function startSvgEdit () { // eslint-disable-line no-unused-vars
|
||||
const url = 'chrome://svg-edit/content/editor/svg-editor.html';
|
||||
|
|
|
@ -61,7 +61,7 @@ console.log(`${output}\nTotal failures found: ${total}.\n`); // eslint-disable-l
|
|||
* Eliminates known false matches against overly generic types.
|
||||
* @param {string} file
|
||||
* @param {external:FindInFilesResult} res
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function reduceFalseMatches (file, res) {
|
||||
switch (file) {
|
||||
|
|
|
@ -286,7 +286,7 @@ const slides = document.querySelectorAll('.slide');
|
|||
|
||||
/**
|
||||
* Show or hide the counters.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleCounter () {
|
||||
[...counters].forEach(function (el) {
|
||||
|
@ -296,7 +296,7 @@ function toggleCounter () {
|
|||
|
||||
/**
|
||||
* Add or remove `reduced` (size) class.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleSize () {
|
||||
[...slides].forEach(function (el) {
|
||||
|
@ -310,7 +310,7 @@ function toggleSize () {
|
|||
|
||||
/**
|
||||
* Add or remove `no-transitions` class.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleTransitions () {
|
||||
[...slides].forEach(function (el) {
|
||||
|
@ -324,7 +324,7 @@ function toggleTransitions () {
|
|||
|
||||
/**
|
||||
* Add or remove `no-gradients` class.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function toggleGradients () {
|
||||
[...slides].forEach(function (el) {
|
||||
|
|
|
@ -10,7 +10,7 @@ QUnit.log((details) => {
|
|||
|
||||
/**
|
||||
* Tear down tests, resetting custom menus.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
contextmenu.resetCustomMenus();
|
||||
|
|
|
@ -21,7 +21,7 @@ let elemId = 1;
|
|||
|
||||
/**
|
||||
* Set up tests with mock data.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
// Mock out editor context.
|
||||
|
@ -52,7 +52,7 @@ function setUp () {
|
|||
|
||||
/**
|
||||
* Tear down tests, removing elements.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
while (svg.hasChildNodes()) {
|
||||
|
|
|
@ -50,14 +50,14 @@ class MockHistoryEventHandler {
|
|||
|
||||
/**
|
||||
* Set up tests (with undo manager).
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
undoMgr = new hstory.UndoManager();
|
||||
}
|
||||
/**
|
||||
* Tear down tests, destroying undo manager.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
undoMgr = null;
|
||||
|
|
|
@ -5,7 +5,7 @@ const NEAR_ZERO = 5e-6; // 0.000005, Firefox fails at higher levels of precision
|
|||
* @param {Float} actual
|
||||
* @param {Float} expected
|
||||
* @param {string} message
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function almostEquals (actual, expected, message) {
|
||||
message = message || (actual + ' did not equal ' + expected);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* @param {Float} expected
|
||||
* @param {Float} maxDifference (the maximum inclusive difference allowed between the actual and expected numbers)
|
||||
* @param {string} [message] Defaults to structured message
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function close (actual, expected, maxDifference, message) {
|
||||
const actualDiff = (actual === expected) ? 0 : Math.abs(actual - expected),
|
||||
|
@ -27,7 +27,7 @@ function close (actual, expected, maxDifference, message) {
|
|||
* @param {Float} expected
|
||||
* @param {Float} maxPercentDifference (the maximum inclusive difference percentage allowed between the actual and expected numbers)
|
||||
* @param {string} [message] Defaults to a structured message
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function closePercent (actual, expected, maxPercentDifference, message) {
|
||||
let actualDiff, result;
|
||||
|
@ -57,7 +57,7 @@ function closePercent (actual, expected, maxPercentDifference, message) {
|
|||
* @param {Float} expected
|
||||
* @param {Float} minDifference (the minimum exclusive difference allowed between the actual and expected numbers)
|
||||
* @param {string} [message] Defaults to structured message
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function notClose (actual, expected, minDifference, message) {
|
||||
const actualDiff = Math.abs(actual - expected),
|
||||
|
@ -76,7 +76,7 @@ function notClose (actual, expected, minDifference, message) {
|
|||
* @param {Float} expected
|
||||
* @param {Float} minPercentDifference (the minimum exclusive difference percentage allowed between the actual and expected numbers)
|
||||
* @param {string} [message] Defaults to a structured message
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function notClosePercent (actual, expected, minPercentDifference, message) {
|
||||
let actualDiff, result;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* @param {GenericObject} obj
|
||||
* @param {GenericCallback} fn
|
||||
* @param {Any} arg1
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function expectOutOfBoundsException (obj, fn, arg1) {
|
||||
const expected = true;
|
||||
|
|
|
@ -23,7 +23,7 @@ let elemId = 1;
|
|||
|
||||
/**
|
||||
* Initilize modules to set up the tests.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
utilities.init(
|
||||
|
@ -65,7 +65,7 @@ let elem;
|
|||
|
||||
/**
|
||||
* Initialize for tests and set up `rect` element.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUpRect () {
|
||||
setUp();
|
||||
|
@ -79,7 +79,7 @@ function setUpRect () {
|
|||
|
||||
/**
|
||||
* Initialize for tests and set up `text` element with `tspan` child.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUpTextWithTspan () {
|
||||
setUp();
|
||||
|
@ -99,7 +99,7 @@ function setUpTextWithTspan () {
|
|||
|
||||
/**
|
||||
* Tear down the tests (empty the svg element).
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
while (svg.hasChildNodes()) {
|
||||
|
|
|
@ -35,7 +35,7 @@ const mockFactory = {
|
|||
|
||||
/**
|
||||
* Potentially reusable test set-up.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
svgroot = mockFactory.createSVGElement({
|
||||
|
@ -72,7 +72,7 @@ function setUpWithInit () {
|
|||
|
||||
/**
|
||||
* Tear down the test by emptying our sandbox area.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
while (sandbox.hasChildNodes()) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
* @param {PlainObject} implementations
|
||||
* @param {external:sinon} implementations.sinon
|
||||
* @param {external:QUnit} implementations.QUnit
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
export default function sinonQunit ({sinon, QUnit}) {
|
||||
sinon.assert.fail = function (msg) {
|
||||
|
|
|
@ -23,7 +23,7 @@ let svgcontent, rect, circle;
|
|||
|
||||
/**
|
||||
* Set up tests, adding elements.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
svgcontent = svgroot.appendChild(document.createElementNS(NS.SVG, 'svg'));
|
||||
|
@ -35,7 +35,7 @@ function setUp () {
|
|||
|
||||
/**
|
||||
* Tear down tests, emptying SVG root, and resetting list map.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function tearDown () {
|
||||
transformlist.resetListMap();
|
||||
|
|
|
@ -10,7 +10,7 @@ QUnit.log((details) => {
|
|||
|
||||
/**
|
||||
* Set up tests, supplying mock data.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function setUp () {
|
||||
units.init(
|
||||
|
|
|
@ -46,7 +46,7 @@ const textWithMatrixTransform = document.getElementById('svg_text_with_matrix_tr
|
|||
* Toward performance testing, fill document with clones of element.
|
||||
* @param {SVGElement} elem
|
||||
* @param {Integer} count
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function fillDocumentByCloningElement (elem, count) {
|
||||
const elemId = elem.getAttribute('id') + '-';
|
||||
|
|
|
@ -65,21 +65,21 @@ const mockCount = {
|
|||
|
||||
/**
|
||||
* Increments clear seleciton count for mock test.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mockClearSelection () {
|
||||
mockCount.clearSelection++;
|
||||
}
|
||||
/**
|
||||
* Increments add selection count for mock test.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mockAddToSelection () {
|
||||
mockCount.addToSelection++;
|
||||
}
|
||||
/**
|
||||
* Increments add command to history count for mock test.
|
||||
* @returns {undefined}
|
||||
* @returns {void}
|
||||
*/
|
||||
function mockAddCommandToHistory () {
|
||||
mockCount.addCommandToHistory++;
|
||||
|
|
Loading…
Reference in New Issue