- 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

@@ -8,7 +8,7 @@
*/
import {NS} from './namespaces.js';
import {toXml, walkTree} from './utilities.js';
import {toXml, walkTree, isNullish} from './utilities.js';
const $ = jQuery;
@@ -117,7 +117,7 @@ class Layer {
*/
getOpacity () {
const opacity = this.group_.getAttribute('opacity');
if (opacity === null || opacity === undefined) {
if (isNullish(opacity)) {
return 1;
}
return parseFloat(opacity);
@@ -212,7 +212,7 @@ Layer.CLASS_REGEX = new RegExp('(\\s|^)' + Layer.CLASS_NAME + '(\\s|$)');
*/
function addLayerClass (elem) {
const classes = elem.getAttribute('class');
if (classes === null || classes === undefined || !classes.length) {
if (isNullish(classes) || !classes.length) {
elem.setAttribute('class', Layer.CLASS_NAME);
} else if (!Layer.CLASS_REGEX.test(classes)) {
elem.setAttribute('class', classes + ' ' + Layer.CLASS_NAME);