- Linting (ESLint): Stricter rules (or switch to warning)

- Breaking internal API change: `updateGripCursor` moved to be class method of Selector rather than instance method
- Breaking internal API change: `subpathIsClosed` moved to be class method of `Path` rather than instance method
- Refactoring: Reuse utilities base64 encoder for SVG icons plugin
- Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and `mouseDown` (may also be a boolean) of `pathActions`; other JSDoc additions/improvements
This commit is contained in:
Brett Zamir
2018-11-07 14:51:50 +08:00
parent 901c9547fe
commit 7c470e9909
126 changed files with 2081 additions and 1373 deletions

View File

@@ -7,6 +7,7 @@
*/
import {NS} from './namespaces.js';
import {isNullish} from './utilities.js';
const wAttrs = ['x', 'x1', 'cx', 'rx', 'width'];
const hAttrs = ['y', 'y1', 'cy', 'ry', 'height'];
@@ -40,7 +41,7 @@ let typeMap_ = {};
*/
/**
* @function module:units.ElementContainer#getElement
* @returns {Element} An element in the container given an id
* @returns {?Element} An element in the container given an id
*/
/**
* @function module:units.ElementContainer#getHeight
@@ -134,8 +135,7 @@ export const getTypeMap = function () {
export const shortFloat = function (val) {
const digits = elementContainer_.getRoundDigits();
if (!isNaN(val)) {
// Note that + converts to Number
return +((+val).toFixed(digits));
return Number(Number(val).toFixed(digits));
}
if (Array.isArray(val)) {
return shortFloat(val[0]) + ',' + shortFloat(val[1]);
@@ -304,7 +304,7 @@ export const isValidUnit = function (attr, val, selectedElement) {
// not already present
try {
const elem = elementContainer_.getElement(val);
result = (elem == null || elem === selectedElement);
result = (isNullish(elem) || elem === selectedElement);
} catch (e) {}
return result;
}