Skip to content

Commit ce221ed

Browse files
committed
Fix defined check
1 parent 2eb9374 commit ce221ed

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

circle-vert.glsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ void main() {
4646
gl_PointSize = (size + borderSize) * pixelRatio;
4747

4848
vec2 pos = (position + translate) * scale
49-
+ (positionFract + translateFract) * scale
50-
+ (position + translate) * scaleFract
51-
+ (positionFract + translateFract) * scaleFract;
49+
+ (positionFract + translateFract) * scale
50+
+ (position + translate) * scaleFract
51+
+ (positionFract + translateFract) * scaleFract;
5252

5353
gl_Position = vec4(pos * 2. - 1., 0, 1);
5454

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"clamp": "^1.0.1",
3434
"color-id": "^1.1.0",
3535
"color-normalize": "^1.0.3",
36-
"defined": "^1.0.0",
3736
"flatten-vertex-data": "^1.0.0",
3837
"glslify": "^6.1.0",
3938
"is-iexplorer": "^1.0.0",

readme.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ Option | Default | Description
5555
`range`, `dataBox` | `null` | Data bounds limiting visible data as `[left, top, right, bottom]`. If `null`, the range is detected as `positions` boundaries.
5656
`viewport`, `viewBox` | `null` | Bounding box limiting visible area within the canvas in pixels, can be an array `[left, top, right, bottom]` or an object `{left, top, right, bottom}` or `{x, y, w, h}`.
5757
`clone` | `null` | Source _scatter2d_ instance to clone for faster creation.
58-
`cluster` | `null` | [Point-cluster](https://github.com/dfcreative/point-cluster) instance for custom points clustering, like kd-tree etc.
59-
<!--
60-
`snap` | `1e5` | Number of points threshold to enable snapping, can be bool. See [snap-points-2d](https://github.com/gl-vis/snap-points-2d).
61-
-->
62-
```
58+
`cluster` | `null` | A bool, number of points threshold to enable snapping or [point-cluster](https://github.com/dfcreative/point-cluster) instance.
6359

6460
### `scatter.update(optionsA, optionsB, ...rest)`
6561

scatter.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const ie = require('is-iexplorer')
1313
const {float32, fract32} = require('to-float32')
1414
const arrayRange = require('array-range')
1515
const parseRect = require('parse-rect')
16-
const defined = require('defined')
1716

1817

1918
module.exports = Scatter
@@ -486,26 +485,26 @@ Scatter.prototype.update = function (...args) {
486485
updateDiff(group, options, [{
487486
snap: true,
488487
size: s => {
489-
if (!defined(s)) s = Scatter.defaults.size
488+
if (s == null) s = Scatter.defaults.size
490489
sizeCount += s && s.length ? 1 : 0
491490
return s
492491
},
493492
borderSize: s => {
494-
if (!defined(s)) s = Scatter.defaults.borderSize
493+
if (s == null) s = Scatter.defaults.borderSize
495494
sizeCount += s && s.length ? 1 : 0
496495
return s
497496
},
498497
opacity: parseFloat,
499498

500499
// add colors to palette, save references
501500
color: (c, group) => {
502-
if (!defined(c)) c = Scatter.defaults.color
501+
if (c == null) c = Scatter.defaults.color
503502
c = this.updateColor(c)
504503
colorCount++
505504
return c
506505
},
507506
borderColor: (c, group) => {
508-
if (!defined(c)) c = Scatter.defaults.borderColor
507+
if (c == null) c = Scatter.defaults.borderColor
509508
c = this.updateColor(c)
510509
colorCount++
511510
return c
@@ -613,7 +612,7 @@ Scatter.prototype.update = function (...args) {
613612
positions: (positions, group) => {
614613
if (!positions || !positions.length) return
615614

616-
let {markerIds, snap, bounds, offset} = group
615+
let { markerIds, snap, bounds, offset } = group
617616

618617
for (let i = 0; i < markerIds.length; i++) {
619618
let ids = markerIds[i]

0 commit comments

Comments
 (0)