geojs 1.8.7 → 1.8.8
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/CHANGELOG.md +6 -0
- package/geo.js +38 -47
- package/geo.lean.js +38 -47
- package/geo.lean.min.js +3 -3
- package/geo.min.js +2 -2
- package/package.json +1 -1
- package/src/graphFeature.js +1 -1
- package/src/heatmapFeature.js +2 -1
- package/src/lineFeature.js +3 -3
- package/src/pixelmapFeature.js +1 -1
- package/src/polygonFeature.js +3 -3
- package/src/quadFeature.js +1 -1
- package/src/trackFeature.js +2 -2
- package/src/transform.js +1 -1
- package/src/util/common.js +11 -0
- package/src/vectorFeature.js +2 -1
- package/src/webgl/lineFeature.js +2 -1
- package/src/webgl/polygonFeature.js +5 -3
package/package.json
CHANGED
package/src/graphFeature.js
CHANGED
package/src/heatmapFeature.js
CHANGED
|
@@ -2,6 +2,7 @@ var $ = require('jquery');
|
|
|
2
2
|
var inherit = require('./inherit');
|
|
3
3
|
var feature = require('./feature');
|
|
4
4
|
var transform = require('./transform');
|
|
5
|
+
var util = require('./util');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Heatmap feature specification.
|
|
@@ -79,7 +80,7 @@ var heatmapFeature = function (arg) {
|
|
|
79
80
|
|
|
80
81
|
this.featureType = 'heatmap';
|
|
81
82
|
|
|
82
|
-
m_position = arg.position ||
|
|
83
|
+
m_position = arg.position || util.identityFunction;
|
|
83
84
|
m_intensity = arg.intensity || function (d) { return 1; };
|
|
84
85
|
m_maxIntensity = arg.maxIntensity !== undefined ? arg.maxIntensity : null;
|
|
85
86
|
m_minIntensity = arg.minIntensity !== undefined ? arg.minIntensity : null;
|
package/src/lineFeature.js
CHANGED
|
@@ -438,8 +438,8 @@ var lineFeature = function (arg) {
|
|
|
438
438
|
});
|
|
439
439
|
|
|
440
440
|
/* Set the reduced lines as the data and use simple accessors. */
|
|
441
|
-
m_this.style('position',
|
|
442
|
-
m_this.style('line',
|
|
441
|
+
m_this.style('position', util.identityFunction);
|
|
442
|
+
m_this.style('line', util.identityFunction);
|
|
443
443
|
m_this.data(data);
|
|
444
444
|
return m_this;
|
|
445
445
|
};
|
|
@@ -465,7 +465,7 @@ var lineFeature = function (arg) {
|
|
|
465
465
|
// Values of 2 and above appear smoothest.
|
|
466
466
|
antialiasing: 2.0,
|
|
467
467
|
closed: false,
|
|
468
|
-
line:
|
|
468
|
+
line: util.identityFunction,
|
|
469
469
|
position: (d) => Array.isArray(d) ? {x: d[0], y: d[1], z: d[2] || 0} : d,
|
|
470
470
|
origin: (p) => (p.length >= 3 ? p.slice(0, 3) : [0, 0, 0])
|
|
471
471
|
},
|
package/src/pixelmapFeature.js
CHANGED
package/src/polygonFeature.js
CHANGED
|
@@ -634,8 +634,8 @@ var polygonFeature = function (arg) {
|
|
|
634
634
|
});
|
|
635
635
|
|
|
636
636
|
/* Set the reduced polgons as the data and use simple accessors. */
|
|
637
|
-
m_this.style('position',
|
|
638
|
-
m_this.style('polygon',
|
|
637
|
+
m_this.style('position', util.identityFunction);
|
|
638
|
+
m_this.style('polygon', util.identityFunction);
|
|
639
639
|
m_this.data(data);
|
|
640
640
|
return m_this;
|
|
641
641
|
};
|
|
@@ -719,7 +719,7 @@ var polygonFeature = function (arg) {
|
|
|
719
719
|
strokeStyle: 'solid',
|
|
720
720
|
strokeColor: {r: 0.0, g: 1.0, b: 1.0},
|
|
721
721
|
strokeOpacity: 1.0,
|
|
722
|
-
polygon:
|
|
722
|
+
polygon: util.identityFunction,
|
|
723
723
|
position: (d) => Array.isArray(d) ? {x: d[0], y: d[1], z: d[2] || 0} : d,
|
|
724
724
|
origin: (items) => {
|
|
725
725
|
for (let i = 0; i < items.length; i += 1) {
|
package/src/quadFeature.js
CHANGED
|
@@ -699,7 +699,7 @@ var quadFeature = function (arg) {
|
|
|
699
699
|
previewImage: null,
|
|
700
700
|
image: function (d) { return d.image; },
|
|
701
701
|
video: function (d) { return d.video; },
|
|
702
|
-
position:
|
|
702
|
+
position: util.identityFunction
|
|
703
703
|
},
|
|
704
704
|
arg.style === undefined ? {} : arg.style
|
|
705
705
|
);
|
package/src/trackFeature.js
CHANGED
|
@@ -814,8 +814,8 @@ var trackFeature = function (arg) {
|
|
|
814
814
|
true,
|
|
815
815
|
{},
|
|
816
816
|
{
|
|
817
|
-
track:
|
|
818
|
-
position:
|
|
817
|
+
track: util.identityFunction,
|
|
818
|
+
position: util.identityFunction,
|
|
819
819
|
time: (d, i) => (d.t !== undefined ? d.t : i)
|
|
820
820
|
},
|
|
821
821
|
arg.style === undefined ? {} : arg.style
|
package/src/transform.js
CHANGED
|
@@ -19,7 +19,7 @@ var maxTransformCacheSize = 10;
|
|
|
19
19
|
|
|
20
20
|
/* A RegExp to detect if two transforms only different by the middle axis's
|
|
21
21
|
* direction. */
|
|
22
|
-
var axisPattern = /^(.* |)
|
|
22
|
+
var axisPattern = /^(.* |)\+axis=e(n|s)u(| .*)$/;
|
|
23
23
|
var affinePattern = /(^|\s)\+(s[1-3][1-3]|[xyz]off)=\S/;
|
|
24
24
|
|
|
25
25
|
/**
|
package/src/util/common.js
CHANGED
|
@@ -1443,6 +1443,17 @@ var util = {
|
|
|
1443
1443
|
return value !== null && value !== undefined && (type === 'object' || type === 'function');
|
|
1444
1444
|
},
|
|
1445
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* Return the first value passed to the function. Using this function for
|
|
1448
|
+
* identity calls can allow some code to bypass making such a call entirely.
|
|
1449
|
+
*
|
|
1450
|
+
* @param {*} d Any value.
|
|
1451
|
+
* @returns {*} The passed value.
|
|
1452
|
+
*/
|
|
1453
|
+
identityFunction: function (d) {
|
|
1454
|
+
return d;
|
|
1455
|
+
},
|
|
1456
|
+
|
|
1446
1457
|
///////////////////////////////////////////////////////////////////////////
|
|
1447
1458
|
/*
|
|
1448
1459
|
* Utility member properties.
|
package/src/vectorFeature.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var inherit = require('./inherit');
|
|
2
2
|
var feature = require('./feature');
|
|
3
|
+
var util = require('./util');
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Object specification for a graph feature.
|
|
@@ -120,7 +121,7 @@ var vectorFeature = function (arg) {
|
|
|
120
121
|
originStyle: 'none',
|
|
121
122
|
endStyle: 'arrow',
|
|
122
123
|
origin: {x: 0, y: 0, z: 0},
|
|
123
|
-
delta:
|
|
124
|
+
delta: util.identityFunction,
|
|
124
125
|
scale: null // size scaling factor (null -> renderer decides)
|
|
125
126
|
},
|
|
126
127
|
arg.style === undefined ? {} : arg.style
|
package/src/webgl/lineFeature.js
CHANGED
|
@@ -178,6 +178,7 @@ var webgl_lineFeature = function (arg) {
|
|
|
178
178
|
if (!onlyStyle) {
|
|
179
179
|
var position = [],
|
|
180
180
|
posFunc = m_this.position();
|
|
181
|
+
posFunc = posFunc === util.identityFunction ? null : posFunc;
|
|
181
182
|
lineItemList = new Array(data.length);
|
|
182
183
|
closed = new Array(data.length);
|
|
183
184
|
for (i = 0; i < data.length; i += 1) {
|
|
@@ -189,7 +190,7 @@ var webgl_lineFeature = function (arg) {
|
|
|
189
190
|
}
|
|
190
191
|
numSegments += lineItem.length - 1;
|
|
191
192
|
for (j = 0; j < lineItem.length; j += 1) {
|
|
192
|
-
pos = posFunc(lineItem[j], j, d, i);
|
|
193
|
+
pos = posFunc ? posFunc(lineItem[j], j, d, i) : lineItem[j];
|
|
193
194
|
position.push(pos.x);
|
|
194
195
|
position.push(simpleInverse ? -pos.y : pos.y);
|
|
195
196
|
position.push(pos.z || 0.0);
|
|
@@ -98,11 +98,13 @@ var webgl_polygonFeature = function (arg) {
|
|
|
98
98
|
|
|
99
99
|
if (!onlyStyle) {
|
|
100
100
|
posFunc = m_this.style.get('position');
|
|
101
|
+
posFunc = posFunc === util.identityFunction ? null : posFunc;
|
|
101
102
|
polyFunc = m_this.style.get('polygon');
|
|
103
|
+
polyFunc = polyFunc === util.identityFunction ? null : polyFunc;
|
|
102
104
|
m_this.data().forEach(function (item, itemIndex) {
|
|
103
105
|
var polygon, outer, geometry, c;
|
|
104
106
|
|
|
105
|
-
polygon = polyFunc(item, itemIndex);
|
|
107
|
+
polygon = polyFunc ? polyFunc(item, itemIndex) : item;
|
|
106
108
|
if (!polygon) {
|
|
107
109
|
return;
|
|
108
110
|
}
|
|
@@ -116,7 +118,7 @@ var webgl_polygonFeature = function (arg) {
|
|
|
116
118
|
* test). */
|
|
117
119
|
geometry = new Array(outer.length * 3);
|
|
118
120
|
for (i = d3 = 0; i < outer.length; i += 1, d3 += 3) {
|
|
119
|
-
c = posFunc(outer[i], i, item, itemIndex);
|
|
121
|
+
c = posFunc ? posFunc(outer[i], i, item, itemIndex) : outer[i];
|
|
120
122
|
geometry[d3] = c.x;
|
|
121
123
|
geometry[d3 + 1] = simpleInverse ? -c.y : c.y;
|
|
122
124
|
// ignore the z values until we support them
|
|
@@ -133,7 +135,7 @@ var webgl_polygonFeature = function (arg) {
|
|
|
133
135
|
original = original.concat(hole);
|
|
134
136
|
geometry.holes.push(d3 / 3);
|
|
135
137
|
for (i = 0; i < hole.length; i += 1, d3 += 3) {
|
|
136
|
-
c = posFunc(hole[i], i, item, itemIndex);
|
|
138
|
+
c = posFunc ? posFunc(hole[i], i, item, itemIndex) : hole[i];
|
|
137
139
|
geometry.vertices[d3] = c.x;
|
|
138
140
|
geometry.vertices[d3 + 1] = simpleInverse ? -c.y : c.y;
|
|
139
141
|
// ignore the z values until we support them
|