mascot-vis 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mascot-min.js +21 -21
- package/dist/mascot.js +63 -7
- package/package.json +1 -1
package/dist/mascot.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
// version: 1.11.
|
|
2
|
+
// version: 1.11.1
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3'), require('pixi.js')) :
|
|
5
5
|
typeof define === 'function' && define.amd ? define(['exports', 'd3', 'pixi.js'], factory) :
|
|
@@ -260,6 +260,18 @@
|
|
|
260
260
|
CANNOT_CLASSIFY: "Cannot classify items in "
|
|
261
261
|
};
|
|
262
262
|
|
|
263
|
+
const categoricalColorSchemes = [
|
|
264
|
+
"schemeCategory10", "schemeAccent", "schemeDark2", "schemePaired", "schemePastel1", "schemePastel2", "schemeSet1", "schemeSet2", "schemeSet3", "schemeTableau10"
|
|
265
|
+
];
|
|
266
|
+
|
|
267
|
+
const divergingColorSchemes = [
|
|
268
|
+
"schemeBrBG", "schemePRGn", "schemePiYG", "schemePuOr", "schemeRdBu", "schemeRdGy", "schemeRdYlBu", "schemeRdYlGn", "schemeSpectral"
|
|
269
|
+
];
|
|
270
|
+
|
|
271
|
+
const sequentialColorSchemes = [
|
|
272
|
+
"schemeBlues", "schemeGreens", "schemeGreys", "schemeOranges", "schemePurples", "schemeReds", "schemeBuGn", "schemeBuPu", "schemeGnBu", "schemeOrRd", "schemePuBuGn", "schemePuBu", "schemePuRd", "schemeRdPu", "schemeYlGnBu", "schemeYlGn", "schemeYlOrBr", "schemeYlOrRd"
|
|
273
|
+
];
|
|
274
|
+
|
|
263
275
|
class Layout {
|
|
264
276
|
|
|
265
277
|
constructor(args){
|
|
@@ -4161,7 +4173,16 @@
|
|
|
4161
4173
|
if (this.scale) {
|
|
4162
4174
|
this.scale.domain = Array.from(new Set(this.scale.domain.concat(this.data)));
|
|
4163
4175
|
} else {
|
|
4164
|
-
|
|
4176
|
+
let args = {scheme: "schemeCategory10"};
|
|
4177
|
+
if (this._scheme) {
|
|
4178
|
+
if (categoricalColorSchemes.indexOf(this._scheme) >= 0) {
|
|
4179
|
+
args.scheme = this._scheme;
|
|
4180
|
+
} else if (divergingColorSchemes.indexOf(this._scheme) >= 0 || sequentialColorSchemes.indexOf(this._scheme) >= 0) {
|
|
4181
|
+
args.scheme = this._scheme;
|
|
4182
|
+
args.size = this.data.length;
|
|
4183
|
+
}
|
|
4184
|
+
}
|
|
4185
|
+
this.scale = createScale("ordinalColor", args);
|
|
4165
4186
|
this.scale.domain = this.data;
|
|
4166
4187
|
if (this._mapping) {
|
|
4167
4188
|
let range = this.scale.domain.map(d => d in this._mapping ? this._mapping[d] : "black");
|
|
@@ -7073,6 +7094,12 @@
|
|
|
7073
7094
|
return false;
|
|
7074
7095
|
}
|
|
7075
7096
|
|
|
7097
|
+
_doTranslate(dx, dy) {
|
|
7098
|
+
super._doTranslate(dx, dy);
|
|
7099
|
+
this._x += dx;
|
|
7100
|
+
this._y += dy;
|
|
7101
|
+
}
|
|
7102
|
+
|
|
7076
7103
|
}
|
|
7077
7104
|
|
|
7078
7105
|
class Glyph extends Group {
|
|
@@ -7335,7 +7362,13 @@
|
|
|
7335
7362
|
this.direction = d;
|
|
7336
7363
|
this.items = items;
|
|
7337
7364
|
this.type = ConstraintType.Align;
|
|
7338
|
-
this.
|
|
7365
|
+
this._orientation = [Alignment.Top, Alignment.Middle, Alignment.Bottom].indexOf(d) >= 0 ? Orientation.Vertical : Orientation.Horizontal;
|
|
7366
|
+
this._itemIds = this.items.map(d => d.classId).sort().join("_");
|
|
7367
|
+
this.id = this.type + "_" + this._itemIds + "_" + this._orientation;
|
|
7368
|
+
}
|
|
7369
|
+
|
|
7370
|
+
get orientation() {
|
|
7371
|
+
return this._orientation;
|
|
7339
7372
|
}
|
|
7340
7373
|
|
|
7341
7374
|
apply() {
|
|
@@ -7348,7 +7381,7 @@
|
|
|
7348
7381
|
baseline = d3__namespace.mean(this.items.map(d => d.bounds[dir]));
|
|
7349
7382
|
|
|
7350
7383
|
let delta = this.items.map(d => baseline - d.bounds[dir]),
|
|
7351
|
-
axis = dir == Alignment.
|
|
7384
|
+
axis = dir == Alignment.Top || dir == Alignment.Middle || dir == Alignment.Bottom ? "y" : "x";
|
|
7352
7385
|
this.items.forEach((d,i) => {
|
|
7353
7386
|
if (d.parent && d.parent.layout && d.parent.layout.type == LayoutType.Stack){
|
|
7354
7387
|
let dx = axis == "x" ? delta[i] : 0,
|
|
@@ -9524,6 +9557,24 @@
|
|
|
9524
9557
|
this.constraints = {};
|
|
9525
9558
|
}
|
|
9526
9559
|
|
|
9560
|
+
removeConstraint(c) {
|
|
9561
|
+
delete this.constraints[c.id];
|
|
9562
|
+
}
|
|
9563
|
+
|
|
9564
|
+
getRelatedConstraints(items) {
|
|
9565
|
+
let cstrs = [];
|
|
9566
|
+
for (let cid in this.constraints) {
|
|
9567
|
+
let c = this.constraints[cid];
|
|
9568
|
+
switch (c.type) {
|
|
9569
|
+
case ConstraintType.Align:
|
|
9570
|
+
if (c._itemIds === items.map(d => d.classId).sort().join("_"))
|
|
9571
|
+
cstrs.push(c);
|
|
9572
|
+
break;
|
|
9573
|
+
}
|
|
9574
|
+
}
|
|
9575
|
+
return cstrs;
|
|
9576
|
+
}
|
|
9577
|
+
|
|
9527
9578
|
// alignInCell(item, direction) {
|
|
9528
9579
|
// //TODO replace grid.vertCellAlignment and grid.horzCellAlignment
|
|
9529
9580
|
// }
|
|
@@ -10639,7 +10690,7 @@
|
|
|
10639
10690
|
this._scale = d3__namespace.scaleOrdinal();
|
|
10640
10691
|
break;
|
|
10641
10692
|
case "ordinalColor":
|
|
10642
|
-
this._scale = d3__namespace.scaleOrdinal(args
|
|
10693
|
+
this._scale = d3__namespace.scaleOrdinal(args? args.size ? d3__namespace[args.scheme][args.size] : d3__namespace[args.scheme] : d3__namespace.schemeCategory10);
|
|
10643
10694
|
break;
|
|
10644
10695
|
case "power":
|
|
10645
10696
|
this._scale = d3__namespace.scalePow().exponent(2);
|
|
@@ -24040,8 +24091,13 @@
|
|
|
24040
24091
|
if (!item.children || item.children.length == 0) {
|
|
24041
24092
|
return item.contains(x, y) && item.type !== ItemType.Scene ? item : null
|
|
24042
24093
|
}
|
|
24043
|
-
|
|
24044
|
-
|
|
24094
|
+
let children = item.children;
|
|
24095
|
+
if (item.type === ItemType.Scene) {
|
|
24096
|
+
children = children.slice();
|
|
24097
|
+
children.sort((a,b) => isGuide(a) ? 1 : isGuide(b) ? -1 : 0 );
|
|
24098
|
+
}
|
|
24099
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
24100
|
+
let c = children[i];
|
|
24045
24101
|
if (c.contains(x, y))
|
|
24046
24102
|
return c;
|
|
24047
24103
|
}
|