gridviz 3.0.29 → 3.0.30
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/gridviz.js +14 -4
- package/dist/gridviz.min.js +1 -1
- package/package.json +1 -1
- package/src/style/SideTanakaStyle.js +13 -3
package/package.json
CHANGED
|
@@ -35,9 +35,17 @@ export class SideTanakaStyle extends Style {
|
|
|
35
35
|
this.colorDark = opts.colorDark || '#111'
|
|
36
36
|
// the bright color: for side facing the light (coming from NW)
|
|
37
37
|
this.colorBright = opts.colorBright || '#ddd'
|
|
38
|
+
//
|
|
39
|
+
this.revert = opts.revert == undefined? false : opts.revert
|
|
38
40
|
|
|
39
41
|
/** Set to A or true so that the side is drawn as a diamond */
|
|
40
42
|
this.diamond = opts.diamond
|
|
43
|
+
|
|
44
|
+
/* Determines what to do for limit sides, between a cell with value and one with no value
|
|
45
|
+
* steep: the cell value absence is equivalent to 0. It shows potentially a steep limit then.
|
|
46
|
+
* skip: no side is drawn
|
|
47
|
+
* step: a side with a 1 step */
|
|
48
|
+
this.limit = opts.limit || "steep"
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
/**
|
|
@@ -61,8 +69,8 @@ export class SideTanakaStyle extends Style {
|
|
|
61
69
|
const cl1 = side.c1 ? classifier(side.c1) : undefined
|
|
62
70
|
const cl2 = side.c2 ? classifier(side.c2) : undefined
|
|
63
71
|
if (cl1 === undefined && cl2 === undefined) return undefined
|
|
64
|
-
if (cl1 === undefined) return cl2
|
|
65
|
-
if (cl2 === undefined) return -cl1
|
|
72
|
+
if (cl1 === undefined) return this.limit=="none"? undefined : this.limit=="steep"? cl2 : Math.sign(cl2)
|
|
73
|
+
if (cl2 === undefined) return this.limit=="none"? undefined : this.limit=="steep"? -cl1 : Math.sign(-cl1)
|
|
66
74
|
return cl2 - cl1
|
|
67
75
|
}
|
|
68
76
|
|
|
@@ -78,6 +86,8 @@ export class SideTanakaStyle extends Style {
|
|
|
78
86
|
//draw sides
|
|
79
87
|
ctx.lineCap = 'butt'
|
|
80
88
|
const r2 = resolution * 0.5
|
|
89
|
+
const cd = this.revert? this.colorBright : this.colorDark
|
|
90
|
+
const cb = this.revert? this.colorDark : this.colorBright
|
|
81
91
|
for (let side of sides) {
|
|
82
92
|
|
|
83
93
|
//get side value
|
|
@@ -86,7 +96,7 @@ export class SideTanakaStyle extends Style {
|
|
|
86
96
|
|
|
87
97
|
//color
|
|
88
98
|
/** @type {string|undefined} */
|
|
89
|
-
const col = ((v < 0 && side.or === 'h') || (v > 0 && side.or === 'v')) ?
|
|
99
|
+
const col = ((v < 0 && side.or === 'h') || (v > 0 && side.or === 'v')) ? cb : cd
|
|
90
100
|
if (!col || col == 'none') continue
|
|
91
101
|
|
|
92
102
|
if (this.diamond) {
|