Skip to content

Commit 13a6ba0

Browse files
authored
Merge pull request #124 from casperhart/dependency-update
update dependencies
2 parents 4a5baa7 + 2d5e9d9 commit 13a6ba0

File tree

10 files changed

+154013
-7861
lines changed

10 files changed

+154013
-7861
lines changed

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 363 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-1.22.22.cjs

Lines changed: 148049 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-3.1.1.cjs

Lines changed: 0 additions & 768 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
yarnPath: .yarn/releases/yarn-3.1.1.cjs
21
nodeLinker: node-modules
2+
3+
plugins:
4+
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
5+
spec: "@yarnpkg/plugin-interactive-tools"
6+
7+
yarnPath: .yarn/releases/yarn-1.22.22.cjs

inst/htmlwidgets/lib/detourr.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/htmlwidgets/lib/detourr.bundle.js.LICENSE.txt

Lines changed: 230 additions & 52 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
"name": "detourr",
33
"license": "MIT",
44
"dependencies": {
5-
"@stdlib/math-base-special-betainc": "^0.0.6",
6-
"@tensorflow/tfjs-backend-wasm": "^3.15.0",
7-
"@tensorflow/tfjs-core": "^3.15.0",
5+
"@stdlib/math-base-special-betainc": "^0.2.2",
6+
"@tensorflow/tfjs-backend-wasm": "^4.0.0",
7+
"@tensorflow/tfjs-core": "^4.0.0",
88
"shiny": "https://github.com/rstudio/shiny#v1.8.0",
9-
"three": "^0.128.0",
9+
"three": "^0.176.0",
1010
"url-loader": "^4.1.1"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "^7.14.3",
1414
"@babel/register": "^7.13.16",
15-
"@types/three": "^0.129.1",
15+
"@types/three": "^0.176.0",
1616
"@typescript-eslint/eslint-plugin": "latest",
17-
"@typescript-eslint/parser": "^5.10.1",
18-
"copy-webpack-plugin": "^9.0.0",
19-
"css-loader": "^6.0.0",
20-
"eslint": "^8.8.0",
21-
"eslint-config-prettier": "^8.3.0",
22-
"prettier": "^2.5.1",
23-
"style-loader": "^3.1.0",
17+
"@typescript-eslint/parser": "^8.32.0",
18+
"copy-webpack-plugin": "^13.0.0",
19+
"css-loader": "^7.1.2",
20+
"eslint": "^9.26.0",
21+
"eslint-config-prettier": "^10.1.5",
22+
"prettier": "^3.5.3",
23+
"style-loader": "^4.0.0",
2424
"ts-loader": "^9.1.2",
25-
"typescript": "^4.2.4",
25+
"typescript": "^5.8.3",
2626
"webpack": "^5.35.1",
27-
"webpack-cli": "^4.6.0",
28-
"webpack-dev-server": "^4.13.3"
27+
"webpack-cli": "^6.0.1",
28+
"webpack-dev-server": "^5.2.1"
2929
},
3030
"scripts": {
3131
"build": "rm -rf inst/htmlwidgets/lib/scatter_widget && webpack --config ./webpack/package.config.ts && R -q -e 'devtools::document(); devtools::build_readme()' && R CMD INSTALL $(git rev-parse --show-toplevel)",
@@ -41,5 +41,5 @@
4141
"async": "^2.6.4",
4242
"follow-redirects": "1.14.8"
4343
},
44-
"packageManager": "yarn@3.1.1"
44+
"packageManager": "yarn@1.22.22"
4545
}

srcts/show_scatter/show_scatter.ts

Lines changed: 80 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export abstract class DisplayScatter {
7070
protected auxEdgeBuffer: THREE.BufferGeometry;
7171
protected highlightedPoints: Array<number> = null;
7272

73-
7473
public container: HTMLDivElement;
7574
public canvas: HTMLCanvasElement = document.createElement("canvas");
7675
public shinyMode: boolean;
@@ -112,7 +111,12 @@ export abstract class DisplayScatter {
112111
private crosstalkSelectionHandle?: any;
113112
private crosstalkFilterHandle?: any;
114113

115-
constructor(containerElement: HTMLDivElement, width: number, height: number, shinyMode: boolean) {
114+
constructor(
115+
containerElement: HTMLDivElement,
116+
width: number,
117+
height: number,
118+
shinyMode: boolean
119+
) {
116120
this.width = width;
117121
this.height = height;
118122
this.shinyMode = shinyMode;
@@ -155,20 +159,20 @@ export abstract class DisplayScatter {
155159

156160
this.auxEdgeData = undefined;
157161
if (this.auxEdge !== undefined) {
158-
this.scene.remove(this.auxEdge)
159-
this.auxEdge.geometry.dispose()
162+
this.scene.remove(this.auxEdge);
163+
this.auxEdge.geometry.dispose();
160164
this.auxEdge = undefined;
161165
}
162166

163167
for (let i = 0; i < this.n; i++) {
164-
this.pointAlphas.set([this.config.alpha], i)
168+
this.pointAlphas.set([this.config.alpha], i);
165169
}
166170
this.pointAlphas.needsUpdate = true;
167171
this.points.geometry.getAttribute("alpha").needsUpdate = true;
168172
this.renderer.render(this.scene, this.camera);
169173
this.animate();
170174
}
171-
})
175+
});
172176
}
173177

174178
this.pointAlphas = this.getPointAlphas();
@@ -213,27 +217,26 @@ export abstract class DisplayScatter {
213217

214218
// Creates a buffer attribute of 1 dimension containing value repeated for times
215219
public createFilledAttribute(value: number, times: number) {
216-
return new THREE.BufferAttribute(new Float32Array(times).fill(value), 1)
220+
return new THREE.BufferAttribute(new Float32Array(times).fill(value), 1);
217221
}
218222

219223
// Create points to be added to the scene
220224
public createPoints(
221225
size: number,
222226
currentFrameBuffer: THREE.BufferAttribute,
223227
pointColours: THREE.BufferAttribute,
224-
pointAlphas: THREE.BufferAttribute,
228+
pointAlphas: THREE.BufferAttribute
225229
): THREE.Points<THREE.BufferGeometry, THREE.Material | THREE.Material[]> {
226-
227230
const pointsGeometry = new THREE.BufferGeometry();
228231
const pointSize = size / 10;
229232

230233
const shaderOpts = this.getShaderOpts();
231234
const pointsMaterial = new THREE.ShaderMaterial(shaderOpts);
232235

233236
pointsGeometry.setAttribute("position", currentFrameBuffer);
234-
var sizes = new Float32Array(this.n)
235-
sizes.fill(pointSize)
236-
pointsGeometry.setAttribute("size", new THREE.BufferAttribute(sizes, 1))
237+
var sizes = new Float32Array(this.n);
238+
sizes.fill(pointSize);
239+
pointsGeometry.setAttribute("size", new THREE.BufferAttribute(sizes, 1));
237240
var points = new THREE.Points(pointsGeometry, pointsMaterial);
238241
points.geometry.setAttribute("color", pointColours);
239242
points.geometry.setAttribute("alpha", pointAlphas);
@@ -260,8 +263,10 @@ export abstract class DisplayScatter {
260263
// set color
261264
const point_color = new THREE.Color();
262265
const bufferArray = new Float32Array(data_tensor.shape[0] * 3); // just one point hence just rgb
263-
for (var i = 0; i < data_tensor.shape[0] * 3; i += 3) {
264-
point_color.set(typeof colour === "string" ? colour : colour[Math.floor(i / 3)]);
266+
for (let i = 0; i < data_tensor.shape[0] * 3; i += 3) {
267+
point_color.set(
268+
typeof colour === "string" ? colour : colour[Math.floor(i / 3)]
269+
);
265270
bufferArray[i] = point_color.r;
266271
bufferArray[i + 1] = point_color.g;
267272
bufferArray[i + 2] = point_color.b;
@@ -270,14 +275,16 @@ export abstract class DisplayScatter {
270275
const bufferPosAttrForCurrentFrame = this.getPointsBuffer(
271276
currentFrame % this.projectionMatrices.length,
272277
data_tensor
273-
)
278+
);
274279

275280
const point = this.createPoints(
276281
size == null ? this.config.size : size,
277282
bufferPosAttrForCurrentFrame,
278283
new THREE.BufferAttribute(bufferArray, 3),
279-
alpha == null ? this.pointAlphas : this.createFilledAttribute(alpha, data_tensor.shape[0])
280-
)
284+
alpha == null
285+
? this.pointAlphas
286+
: this.createFilledAttribute(alpha, data_tensor.shape[0])
287+
);
281288

282289
this.scene.add(point);
283290
this.renderer.render(this.scene, this.camera);
@@ -288,8 +295,8 @@ export abstract class DisplayScatter {
288295
public addEdges(data: Array<Array<number>>) {
289296
if (this.auxEdgeData) {
290297
this.auxEdgeData = undefined;
291-
this.scene.remove(this.auxEdge)
292-
this.auxEdge.geometry.dispose()
298+
this.scene.remove(this.auxEdge);
299+
this.auxEdge.geometry.dispose();
293300
this.auxEdge = undefined;
294301
}
295302
this.auxEdgeData = data.flat();
@@ -312,12 +319,15 @@ export abstract class DisplayScatter {
312319
public highlightPoints(point_list: Array<number>, alpha: number = null) {
313320
if (this.highlightedPoints != null) {
314321
for (let i = 0; i < this.n; i++) {
315-
this.pointAlphas.set([this.config.alpha], i)
322+
this.pointAlphas.set([this.config.alpha], i);
316323
}
317324
}
318325
for (let i = 0; i < this.n; i++) {
319326
if (!point_list.includes(i)) {
320-
this.pointAlphas.set([alpha == null ? this.config.alpha / 8 : alpha], i)
327+
this.pointAlphas.set(
328+
[alpha == null ? this.config.alpha / 8 : alpha],
329+
i
330+
);
321331
}
322332
}
323333
this.highlightedPoints = point_list;
@@ -328,13 +338,16 @@ export abstract class DisplayScatter {
328338
}
329339

330340
public enlargePoints(point_list: Array<number>, size: number = null) {
331-
var sizes = new Float32Array(this.n)
332-
sizes.fill(this.config.size / 10)
333-
point_list.forEach(index => {
341+
var sizes = new Float32Array(this.n);
342+
sizes.fill(this.config.size / 10);
343+
point_list.forEach((index) => {
334344
sizes[index] = size / 10;
335345
});
336346

337-
this.points.geometry.setAttribute("size", new THREE.BufferAttribute(sizes, 1));
347+
this.points.geometry.setAttribute(
348+
"size",
349+
new THREE.BufferAttribute(sizes, 1)
350+
);
338351
(this.points.material as THREE.ShaderMaterial).needsUpdate = true;
339352
this.renderer.render(this.scene, this.camera);
340353
this.animate();
@@ -352,24 +365,27 @@ export abstract class DisplayScatter {
352365
public clearEdges() {
353366
if (this.auxEdge != undefined) {
354367
this.auxEdgeData = undefined;
355-
this.scene.remove(this.auxEdge)
356-
this.auxEdge.geometry.dispose()
368+
this.scene.remove(this.auxEdge);
369+
this.auxEdge.geometry.dispose();
357370
this.auxEdge = undefined;
358371
}
359372
}
360373

361374
public clearHighlight() {
362375
for (let i = 0; i < this.n; i++) {
363-
this.pointAlphas.set([this.config.alpha], i)
376+
this.pointAlphas.set([this.config.alpha], i);
364377
}
365378
this.pointAlphas.needsUpdate = true;
366379
this.points.geometry.getAttribute("alpha").needsUpdate = true;
367380
}
368381

369382
public clearEnlarge() {
370-
var sizes = new Float32Array(this.n)
371-
sizes.fill(this.config.size / 10)
372-
this.points.geometry.setAttribute("size", new THREE.BufferAttribute(sizes, 1));
383+
var sizes = new Float32Array(this.n);
384+
sizes.fill(this.config.size / 10);
385+
this.points.geometry.setAttribute(
386+
"size",
387+
new THREE.BufferAttribute(sizes, 1)
388+
);
373389
(this.points.material as THREE.ShaderMaterial).needsUpdate = true;
374390
}
375391

@@ -592,7 +608,10 @@ export abstract class DisplayScatter {
592608
this.scene.add(this.axisSegments);
593609
}
594610

595-
private addEdgeSegments(pointsBuffer: THREE.BufferAttribute, edges: number[]): THREE.LineSegments {
611+
private addEdgeSegments(
612+
pointsBuffer: THREE.BufferAttribute,
613+
edges: number[]
614+
): THREE.LineSegments {
596615
const edgesGeometry = new THREE.BufferGeometry();
597616
const edgesMaterial = new THREE.LineBasicMaterial({
598617
color: 0x000000,
@@ -604,7 +623,7 @@ export abstract class DisplayScatter {
604623

605624
this.edgeSegments = new THREE.LineSegments(edgesGeometry, edgesMaterial);
606625
this.scene.add(this.edgeSegments);
607-
return (this.edgeSegments);
626+
return this.edgeSegments;
608627
}
609628

610629
private addContainerElement(containerElement: HTMLDivElement) {
@@ -659,7 +678,10 @@ export abstract class DisplayScatter {
659678
);
660679
}
661680

662-
private getPointsBuffer(i: number, dataset: tf.Tensor2D): THREE.BufferAttribute {
681+
private getPointsBuffer(
682+
i: number,
683+
dataset: tf.Tensor2D
684+
): THREE.BufferAttribute {
663685
// flattened projection matrix
664686
const position = tf.tidy(() => {
665687
return this.project(dataset, this.projectionMatrices[i]);
@@ -746,7 +768,7 @@ export abstract class DisplayScatter {
746768

747769
private addAxisLabels() {
748770
const dpr = this.renderer.getPixelRatio();
749-
if (this.config.axisLabels == []) {
771+
if (this.config.axisLabels.length === 0) {
750772
this.hasAxisLabels = false;
751773
} else {
752774
this.hasAxisLabels = true;
@@ -792,7 +814,7 @@ export abstract class DisplayScatter {
792814

793815
const pixelBuffer = new Uint8Array(4 * width * height);
794816

795-
// re-render the picking scene with smaller points to prevent overplotting
817+
// re-render the picking scene with smaller points to prevent overplotting
796818
// when picking
797819
this.points.geometry.setAttribute("color", this.pickingColours);
798820
(this.points.material as THREE.ShaderMaterial).uniforms.picking.value = 1;
@@ -937,18 +959,24 @@ export abstract class DisplayScatter {
937959
this.filteredPointIndices.includes(id - 1)
938960
) {
939961
const toolTipCoords = this.toolTip.getBoundingClientRect();
940-
this.toolTip.style.left = `${Math.floor(x / dpr) - toolTipCoords.width
941-
}px`;
942-
this.toolTip.style.top = `${Math.floor(y / dpr) - toolTipCoords.height
943-
}px`;
962+
this.toolTip.style.left = `${
963+
Math.floor(x / dpr) - toolTipCoords.width
964+
}px`;
965+
this.toolTip.style.top = `${
966+
Math.floor(y / dpr) - toolTipCoords.height
967+
}px`;
944968
this.toolTip.className = "detourrTooltip visible";
945969
const span = this.toolTip.querySelector("span");
946970
span.innerHTML = `${this.mapping.label[id - 1]}`;
947971
} else {
948972
this.toolTip.className = "detourrTooltip";
949973
}
950974
}
951-
private getCoordsfromClick(event: PointerEvent, canvas: HTMLCanvasElement, dpr: number) {
975+
private getCoordsfromClick(
976+
event: PointerEvent,
977+
canvas: HTMLCanvasElement,
978+
dpr: number
979+
) {
952980
const canvas_coords = canvas.getBoundingClientRect();
953981
const x = (event.x - canvas_coords.left) * dpr * this.scaleX();
954982
const y = (event.y - canvas_coords.top) * dpr * this.scaleY();
@@ -978,11 +1006,10 @@ export abstract class DisplayScatter {
9781006
id != this.backgroundColour &&
9791007
this.filteredPointIndices.includes(id - 1)
9801008
) {
981-
return (id);
1009+
return id;
9821010
} else {
983-
return (null);
1011+
return null;
9841012
}
985-
9861013
}
9871014

9881015
// TODO: break away chunks in to separate functions
@@ -1010,17 +1037,19 @@ export abstract class DisplayScatter {
10101037
const currentAuxFrameBuffer = this.getPointsBuffer(
10111038
currentFrame % this.projectionMatrices.length,
10121039
this.auxData
1013-
)
1040+
);
10141041
this.auxPoint.geometry.setAttribute("position", currentAuxFrameBuffer);
10151042
this.auxPoint.geometry.getAttribute("position").needsUpdate = true;
10161043
this.renderer.render(this.scene, this.camera);
10171044
}
10181045

10191046
if (this.auxEdgeData) {
10201047
const edgesBuffer = this.getEdgesBuffer(
1021-
this.auxPoint.geometry.getAttribute("position") as THREE.BufferAttribute,
1048+
this.auxPoint.geometry.getAttribute(
1049+
"position"
1050+
) as THREE.BufferAttribute,
10221051
this.auxEdgeData
1023-
)
1052+
);
10241053
this.auxEdge.geometry.setAttribute("position", edgesBuffer);
10251054
this.auxEdge.geometry.getAttribute("position").needsUpdate = true;
10261055
this.renderer.render(this.scene, this.camera);
@@ -1033,7 +1062,10 @@ export abstract class DisplayScatter {
10331062
);
10341063
}
10351064
if (this.hasEdges) {
1036-
const edgesBuffer = this.getEdgesBuffer(this.currentFrameBuffer, this.edges);
1065+
const edgesBuffer = this.getEdgesBuffer(
1066+
this.currentFrameBuffer,
1067+
this.edges
1068+
);
10371069
this.edgeSegments.geometry.setAttribute("position", edgesBuffer);
10381070
}
10391071

srcts/show_scatter/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as THREE from "three";
12
export interface Mapping {
23
colour: string[];
34
label: string[];

0 commit comments

Comments
 (0)