Skip to content

Commit 25cd450

Browse files
authored
Merge pull request #9 from flekschas/updated-camera
Updated camera and dev packages
2 parents ed7d57a + c57465d commit 25cd450

8 files changed

Lines changed: 5303 additions & 4542 deletions

File tree

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
os: osx
33
node_js:
4-
- "8"
4+
- "12"
55
addons:
66
apt:
77
packages:
@@ -21,7 +21,7 @@ deploy:
2121
- provider: releases
2222
skip_cleanup: true
2323
api_key:
24-
secure: Ntp/+YWKTfEMpulXwJEdwcLMPqdU4KT5x+slcVFYhr7Z2ho+L0JpRi3RW0mheqXxMxKV0fVFI6eNfjlOoNMcEvCLDjjua6jgwdU+2yM1RDMu1EmFHv/ECKoF0g5flJiIs4UZwpX6RlYS4a75Vr3lB0kd8rX71uqw6H3OUljJqUz6apFlb2gSrp8NpgFUMpBmCrFFCiEjKN/YNenCyyO8m6WgWSPUCGZwcnyklawfuc6xzTmJmTbnIDRQer1zvs8Yhr6c8HBgge9XIotKmrwMGe7Gub+r0DHiIjjfk73+zpYZ4hm0VYbOYoDQFpeGnEVOKzSZEzHxBm004IPkrnmuZgMvv+fFNf3D6vPcmpAh6brVLPQyBb2UYET4R+dKFw0I5u4AmEGLJbOzH8B/ZJs1kvvFu+bzDql9qtwrseS5D6rQp2ojpHVTqjw2n0P2/zpUpv2uzvXdXf9k66CNV+ag0q0JzOtwsgARIqPVLgtr+90qKEcKBVEG6lpkZYpiwz71ui/zi5m8WrtZs8Arf847j1gaAGMEK4Bxmtk/riTmUtySrKDYtLja1NdpDxN7lkYkuE/eXaUTrvrvfQ5alImQA6mDcVw5Qo5tyDZrxRXyP76Ka6ygfgQhPWKOSqxAPdD2Lla2Rcw9Q0PPH6Al3pllFUXvWHuNheJfamrGi+fz6b4=
24+
secure: PCL6FS8GDmgiTFhZ8rPmCgrktRYYT7QV/yyVLZk93J6WTAI5ChbtFusB+O6cyia0+G7CEmNZXwc6OGGs6iXCFAckP2lMqexfeTU35pd0feeN+gcvVdXudUo+FVVkgb2FPBUjj0RvanL6RvuoZHeUFIrTho4VK6gtlm8ErmAA/JZhhRACSI2cwV5GoJQtUl1i0D7KiA/w5AhtMGKhG2kc26MPXF3k715XcO+qpt1M6lK6uu0wonLk3EgH2YqndY4OPoffneQVbL1jwnkCoY4NRyuaQeHjNeUSvxI7QG4c95kFg6XcnCpi9Kqu2o6wZpxIIMlSjYi0C9nja+scdwjaEc/nGO0WTNC/UFbAgK36EkoxFcIaZiDq/dhtNekyDzHmJklrI6iEBMa7Fb3y1PE1dK+FBeHq3G3aVWFRYExZtpKyq16Cj7+588qalOYfgib0WT/EWg9e4vqM2vdw2ALm9gYwM9WJSgVVTRarm1nL4G/2aamCly5zxC9gKzNF6ikxG5cTYHypNZppOaZZ8+iKUYso9VOiGsW6GRXTLxY0oGF+7DU8In5CqxgP/Q6F2BWWKo1cUoFuzqQZ1ixeaq6MehS01CF5JXhrKaN1TTMFAIBizRQnE3pibyGz+Sgms8XtQ0wedS9yXr57joCC5rr6yILzmw9UhUIPdd2p/FbTYr0=
2525
file: dist.zip
2626
on:
2727
branch: master
@@ -31,7 +31,7 @@ deploy:
3131
skip_cleanup: true
3232
email: service@lekschas.de
3333
api_key:
34-
secure: vLBzLaHEGGXCjvqFB5DXp8ox1qx/5wHDiLVZQ0tzYRkiizcqr/xHt9j4CB+CvOMDsqBsXV00qlYdk6lBtRffB2SYXAcMqbDO+jfmu8DC+sLTXS2NOAyy1FVRjk6VdgZqTlBa1MxK1O9ScJSxNiJrwO4zu3IIAkP2v9xqulxD9C9kAJLfRmAtxwtpm1PpGwFL7j5j+DjF/rNEfUq9BUJVwCCGgD847/q07t7zqQ3eDG7VAZKAtU3wgwfComjIiYffzibK9D8U6ILcvCBDeE36jACrmfx+KbQESENeSxotuY/I6w9dGa/gmnS35u2P6K1SuAGgj9IRkkvnhc+krETV22LQi0qfg5ZOzsC8vcWRdJhverwI1aeSz9WxSmKEtY/SlMWaQvt2lxQEJ5n4816fdj1LJuUjy7lUspTW8J/nry4YSc+z/iJtAMKzhJpp40EJEECUSPQq9i0GNBXte7aLrwRABt+oquTuougNTcGAVmULyXkF2xVVOAlvCOcdPmZg/rSR1JLTo4PaeVhMychnwJiaOp5W81MPrVak0yZ+YXoNGyohTssJ3WTxzqVSHYh9NaRnPalKOasQEarBqJav0MUc3GBPVHmfQclAzvmfAmJ5aSNdaj6SWK9Un8CKZeRcIO7XIzSY1j0UGlixE+ZDPrihU3C6UJE6o0IkT612aOI=
34+
secure: o5a+jhH6XPPpa7FGEEly1gq215u5WOGx8SUr1dT/y7I+cAONACvZnYyehW35YhjqYVaMWm5x9DbfE29bpgoz78alzDrLaCqqZ0HB49J1XsLVXLL3Qvm262Irw6Yg87TuSkt2BsTKei2kynj2+b89aWhkUUC3jsxadok2YTkMNfzUcFwH8MfApxFXZ13Icw/T92Am2YERAj5kEYMFPvYutngrw3ds9jsBt7sjltF6N21MqtDN9jyKt9goxk0L7ne4AwdkUCtQQJo+VOIAuUA9W96bQxDzagFWRvUHuUmJBr3IpsGrwRR5beWDDycfjJkP/u6iqawXAuEUbK2q0qBgC4XCjz8NILBcgNZfh+UYAIc+5mVlVCGVJtQ0wgf/7gGbQScSQ+qCA5Hc+BvDWeKy2661J/L1trt/nT+PQjSNuEuT2vllQHQrZOdWkwRIzxDeaTRIqdSNBpCpJi11bpjd//LJn70cooTQVEJPozuJ4NjiAgJQQ8l1jgzn6QJwbpL+WdKNgTt4Bn9J6pHjCKw6c/dEnEj3n3gRP+tuXHR7GHd6ilunGS/00BxWEwSykKc7emVqff/eQNDf4wboiusR1fkMy7X6m1obXxISzAhtTn+x6z26BRLX84WDikvX5YXpb7DaPCg2ri70ebAfxsc5VN8F9m3h9CFaxZyITDSh0FU=
3535
on:
3636
branch: master
3737
tags: true

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Fix a rare glitch in the lasso selection where the lasso would be drawn with a far away point
44
- Smoothify lasso by lowering the min delay and min dist
5+
- Update 2D camera and many dev packages
56

67
**v0.7.3**
78

package-lock.json

Lines changed: 5191 additions & 4451 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dist/*"
1818
],
1919
"scripts": {
20+
"buildd": "rollup -c",
2021
"build": "rollup -c; webpack --config ./webpack.config.js --mode production",
2122
"ghp": "npm run build; rm -rf ../regl-scatterplot-ghp/*; touch ../regl-scatterplot-ghp/.nojekyll; cp -r docs/* ../regl-scatterplot-ghp/",
2223
"lint": "eslint src tests rollup.config.js webpack.config.js",
@@ -29,62 +30,62 @@
2930
"watch": "rollup -cw"
3031
},
3132
"dependencies": {
32-
"camera-2d-simple": "^2.0.0-rc2",
33-
"canvas-camera-2d": "^0.5.5",
34-
"gl-matrix": "^2.8.1",
35-
"is-key-down": "^0.1.0",
36-
"kdbush": "^3.0.0",
37-
"lodash-es": "^4.17.11",
38-
"pub-sub-es": "^1.2.0",
39-
"regl": "^1.3.9",
40-
"regl-line": "^0.1.3",
33+
"@flekschas/dom-2d-camera": "~1.0.0-rc.2",
34+
"camera-2d-simple": "~2.0.0",
35+
"gl-matrix": "~3.1.0",
36+
"is-key-down": "~0.1.0",
37+
"kdbush": "~3.0.0",
38+
"lodash-es": "~4.17.11",
39+
"pub-sub-es": "~1.2.1",
40+
"regl": "~1.3.13",
41+
"regl-line": "~0.1.4",
4142
"scroll-speed": "flekschas/scroll-speed",
42-
"with-raf": "^1.0.0"
43+
"with-raf": "~1.1.1"
4344
},
4445
"peerDependencies": {
45-
"pub-sub-es": "^1.2.0",
46-
"regl": "^1.3.9"
46+
"pub-sub-es": "~1.2.1",
47+
"regl": "~1.3.13"
4748
},
4849
"devDependencies": {
49-
"@babel/core": "^7.1.6",
50-
"@babel/plugin-transform-regenerator": "^7.0.0",
51-
"@babel/polyfill": "^7.0.0",
52-
"@babel/preset-env": "^7.1.6",
50+
"@babel/core": "^7.8.4",
51+
"@babel/plugin-transform-regenerator": "^7.8.3",
52+
"@babel/polyfill": "^7.8.3",
53+
"@babel/preset-env": "^7.8.4",
54+
"@rollup/plugin-commonjs": "^11.0.2",
55+
"@rollup/plugin-json": "^4.0.2",
56+
"@rollup/plugin-node-resolve": "^7.1.0",
5357
"acorn": "^6.0.4",
5458
"babel-loader": "^8.0.4",
5559
"babel-plugin-lodash": "^3.3.4",
5660
"browser-env": "^3.2.5",
57-
"eslint": "^5.9.0",
58-
"eslint-config-airbnb": "^17.1.0",
59-
"eslint-config-prettier": "^v3.3.0",
60-
"eslint-plugin-flowtype": "^2.50.3",
61-
"eslint-plugin-import": "^2.14.0",
62-
"eslint-plugin-jsx-a11y": "^6.1.2",
63-
"eslint-plugin-prettier": "^3.0.0",
64-
"eslint-plugin-react": "^7.11.1",
65-
"esm": "^3.0.84",
66-
"gl": "^4.4.0",
61+
"eslint": "^6.8.0",
62+
"eslint-config-airbnb": "^18.0.1",
63+
"eslint-config-prettier": "^6.10.0",
64+
"eslint-plugin-flowtype": "^4.6.0",
65+
"eslint-plugin-import": "^2.20.1",
66+
"eslint-plugin-jsx-a11y": "^6.2.3",
67+
"eslint-plugin-prettier": "^3.1.2",
68+
"eslint-plugin-react": "^7.18.2",
69+
"esm": "^3.2.25",
70+
"gl": "^4.4.1",
6771
"html-webpack-plugin": "^3.2.0",
68-
"husky": "^1.1.4",
69-
"lint-staged": "^8.1.0",
72+
"husky": "^4.2.1",
73+
"lint-staged": "^10.0.7",
7074
"merge": ">=1.2.1",
71-
"prettier": "^1.15.2",
72-
"pretty-quick": "^1.8.0",
73-
"rollup": "^0.67.3",
74-
"rollup-plugin-babel": "^4.0.3",
75-
"rollup-plugin-commonjs": "^9.2.0",
76-
"rollup-plugin-filesize": "^5.0.1",
77-
"rollup-plugin-json": "^3.1.0",
78-
"rollup-plugin-node-resolve": "^3.4.0",
79-
"rollup-plugin-terser": "^3.0.0",
80-
"rollup-plugin-visualizer": "^0.9.2",
75+
"prettier": "^1.19.1",
76+
"pretty-quick": "^2.0.1",
77+
"rollup": "^1.31.0",
78+
"rollup-plugin-babel": "^4.3.3",
79+
"rollup-plugin-filesize": "^6.2.1",
80+
"rollup-plugin-terser": "^5.2.0",
81+
"rollup-plugin-visualizer": "^3.3.1",
8182
"tap-spec": "^5.0.0",
8283
"tape-run": "^6.0.1",
83-
"webpack": "^4.25.1",
84-
"webpack-cli": "^3.1.2",
85-
"webpack-dev-server": "^3.9.0",
84+
"webpack": "^4.41.5",
85+
"webpack-cli": "^3.3.10",
86+
"webpack-dev-server": "^3.10.2",
8687
"webpack-tape-run": "0.0.7",
87-
"zora": "^2.0.1"
88+
"zora": "^3.1.8"
8889
},
8990
"homepage": "https://github.com/flekschas/regl-scatterplot",
9091
"repository": {

rollup.config.js

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { terser } from 'rollup-plugin-terser';
21
import babel from 'rollup-plugin-babel';
3-
import commonjs from 'rollup-plugin-commonjs';
4-
import resolve from 'rollup-plugin-node-resolve';
2+
import commonjs from '@rollup/plugin-commonjs';
53
import filesize from 'rollup-plugin-filesize';
4+
import json from '@rollup/plugin-json';
5+
import resolve from '@rollup/plugin-node-resolve';
6+
import { terser } from 'rollup-plugin-terser';
67
import visualizer from 'rollup-plugin-visualizer';
78

8-
const VERSION = require('./version.js');
9+
const basePlugins = [resolve(), commonjs({ sourceMap: false }), json()];
910

10-
const configurator = (file, format, plugins) => ({
11+
const configurator = (file, format, plugins = []) => ({
1112
input: 'src/index.js',
1213
output: {
1314
name: 'createScatterplot',
@@ -16,41 +17,25 @@ const configurator = (file, format, plugins) => ({
1617
globals: {
1718
'pub-sub-es': 'createPubSub',
1819
regl: 'createREGL'
19-
},
20-
intro: `${format === 'es' ? 'const' : 'var'} VERSION = ${VERSION};`
20+
}
2121
},
22-
plugins,
22+
plugins: [...basePlugins, ...plugins],
2323
external: ['pub-sub-es', 'regl']
2424
});
2525

2626
const devConfig = configurator('dist/regl-scatterplot.js', 'umd', [
27-
resolve(),
28-
commonjs({ sourceMap: false }),
29-
babel(),
30-
filesize(),
31-
visualizer()
32-
]);
33-
34-
const devConfigEsm = configurator('dist/regl-scatterplot.esm.js', 'es', [
35-
resolve(),
36-
commonjs({ sourceMap: false }),
3727
babel(),
3828
filesize(),
3929
visualizer()
4030
]);
4131

4232
const prodConfig = configurator('dist/regl-scatterplot.min.js', 'umd', [
43-
resolve(),
44-
commonjs({ sourceMap: false }),
4533
babel(),
4634
terser()
4735
]);
4836

49-
const prodConfigEsm = configurator('dist/regl-scatterplot.esm.min.js', 'es', [
50-
resolve(),
51-
commonjs({ sourceMap: false }),
52-
babel(),
53-
terser()
37+
const esmConfig = configurator('dist/regl-scatterplot.esm.js', 'esm', [
38+
filesize()
5439
]);
5540

56-
export default [devConfig, devConfigEsm, prodConfig, prodConfigEsm];
41+
export default [devConfig, prodConfig, esmConfig];

rollup.test.config.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import babel from 'rollup-plugin-babel';
2-
import commonjs from 'rollup-plugin-commonjs';
3-
import resolve from 'rollup-plugin-node-resolve';
4-
import json from 'rollup-plugin-json';
5-
6-
const VERSION = require('./version.js');
2+
import commonjs from '@rollup/plugin-commonjs';
3+
import json from '@rollup/plugin-json';
4+
import resolve from '@rollup/plugin-node-resolve';
75

86
export default {
97
input: './tests/index.js',
108
output: {
119
name: 'test',
1210
format: 'iife',
13-
sourcemap: 'inline',
14-
intro: `var VERSION = ${VERSION};`
11+
sourcemap: 'inline'
1512
},
1613
plugins: [resolve(), commonjs(), babel(), json()]
1714
};

src/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import canvasCamera2d from 'canvas-camera-2d';
1+
import createDom2dCamera from '@flekschas/dom-2d-camera';
22
import KDBush from 'kdbush';
33
import createPubSub from 'pub-sub-es';
44
import withThrottle from 'lodash-es/throttle';
@@ -54,6 +54,8 @@ import {
5454
min
5555
} from './utils';
5656

57+
import { version } from '../package.json';
58+
5759
const createScatterplot = ({
5860
regl: initialRegl,
5961
background: initialBackground = DEFAULT_COLOR_BG,
@@ -609,7 +611,7 @@ const createScatterplot = ({
609611

610612
const [x, y] = searchIndex.points[hoveredPoint].slice(0, 2);
611613

612-
// Normalized device coordinate of the point
614+
// Homogeneous coordinates of the point
613615
const v = [x, y, 0, 1];
614616

615617
// We have to calculate the model-view-projection matrix outside of the
@@ -689,7 +691,12 @@ const createScatterplot = ({
689691
data: createPointIndex(numPoints)
690692
});
691693

692-
searchIndex = new KDBush(newPoints, p => p[0], p => p[1], 16);
694+
searchIndex = new KDBush(
695+
newPoints,
696+
p => p[0],
697+
p => p[1],
698+
16
699+
);
693700

694701
isInit = true;
695702
};
@@ -808,7 +815,7 @@ const createScatterplot = ({
808815
if (property === 'aspectRatio') return dataAspectRatio;
809816
if (property === 'canvas') return canvas;
810817
if (property === 'regl') return regl;
811-
if (property === 'version') return VERSION;
818+
if (property === 'version') return version;
812819

813820
return undefined;
814821
};
@@ -899,7 +906,7 @@ const createScatterplot = ({
899906
};
900907

901908
const initCamera = () => {
902-
camera = canvasCamera2d(canvas);
909+
camera = createDom2dCamera(canvas);
903910

904911
if (initialView) camera.set(mat4.clone(initialView));
905912
else camera.lookAt([...initialTarget], initialDistance, initialRotation);

tests/index.js

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* eslint no-console: 1 */
22

33
import '@babel/polyfill';
4-
import test from 'zora';
4+
import { test } from 'zora';
5+
import { version } from '../package.json';
6+
57
// import { mat4 } from 'gl-matrix';
68

79
import createScatterplot, { createRegl, createTextureFromUrl } from '../src';
@@ -106,8 +108,8 @@ test('get("canvas"), get("regl"), and get("version")', async t => {
106108

107109
t.equal(
108110
scatterplot.get('version'),
109-
VERSION,
110-
`version should be set to ${VERSION}`
111+
version,
112+
`version should be set to ${version}`
111113
);
112114
});
113115

@@ -283,15 +285,25 @@ test('set({ colors })', t => {
283285
'should create 8 normalized RGBAs from 2 HEX'
284286
);
285287

286-
scatterplot.set({ colors: [[0, 141, 255], [255, 0, 218]] });
288+
scatterplot.set({
289+
colors: [
290+
[0, 141, 255],
291+
[255, 0, 218]
292+
]
293+
});
287294
t.ok(
288295
scatterplot
289296
.get('colors')
290297
.every((color, i) => color.every((c, j) => c === rgba2[i][j])),
291298
'should create 8 normalized RGBAs from 2 non-normalized RGB'
292299
);
293300

294-
scatterplot.set({ colors: [[0, 141, 255, 127], [255, 0, 218, 127]] });
301+
scatterplot.set({
302+
colors: [
303+
[0, 141, 255, 127],
304+
[255, 0, 218, 127]
305+
]
306+
});
295307
t.ok(
296308
scatterplot
297309
.get('colors')
@@ -476,7 +488,13 @@ test('click selection with publish("select")', async t => {
476488
const canvas = createCanvas(dim, dim);
477489
const scatterplot = createScatterplot({ canvas, width: dim, height: dim });
478490

479-
const points = [[0, 0], [1, 1], [1, -1], [-1, -1], [-1, 1]];
491+
const points = [
492+
[0, 0],
493+
[1, 1],
494+
[1, -1],
495+
[-1, -1],
496+
[-1, 1]
497+
];
480498
scatterplot.draw(points);
481499

482500
// TODO: fix this!
@@ -521,7 +539,13 @@ test('lasso selection with publish("select")', async t => {
521539
const canvas = createCanvas(dim, dim);
522540
const scatterplot = createScatterplot({ canvas, width: dim, height: dim });
523541

524-
const points = [[0, 0], [1, 1], [1, -1], [-1, -1], [-1, 1]];
542+
const points = [
543+
[0, 0],
544+
[1, 1],
545+
[1, -1],
546+
[-1, -1],
547+
[-1, 1]
548+
];
525549
scatterplot.draw(points);
526550

527551
// TODO: fix this!
@@ -577,7 +601,13 @@ test('point hover with publish("pointover") and publish("pointout")', async t =>
577601
const canvas = createCanvas(dim, dim);
578602
const scatterplot = createScatterplot({ canvas, width: dim, height: dim });
579603

580-
const points = [[0, 0], [1, 1], [1, -1], [-1, -1], [-1, 1]];
604+
const points = [
605+
[0, 0],
606+
[1, 1],
607+
[1, -1],
608+
[-1, -1],
609+
[-1, 1]
610+
];
581611
scatterplot.draw(points);
582612

583613
// TODO: fix this!

0 commit comments

Comments
 (0)