Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"pbf": "^3.2.1",
"polybooljs": "^1.2.0",
"polylabel": "^1.1.0",
"rbush": "^3.0.1",
"rbush-rs": "^0.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
Expand Down
4 changes: 2 additions & 2 deletions src/app/objects/Labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Vec3 from "~/lib/math/Vec3";
import TileLabelBuffers from "./TileLabelBuffers";
import Camera from "~/lib/core/Camera";
import Utils from "../Utils";
import RBush from 'rbush';
import {RBush} from 'rbush-rs';
import Vec2 from "~/lib/math/Vec2";

interface AttributeBuffers {
Expand All @@ -29,7 +29,7 @@ export default class Labels extends RenderableObject3D {
index: null
};
private attributeBuffersDirty: boolean = false;
private tree: RBush<any> = new RBush<any>();
private tree: RBush = new RBush();

public constructor() {
super();
Expand Down
19 changes: 10 additions & 9 deletions src/lib/road-graph/RoadGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Road from "~/lib/road-graph/Road";
import Intersection from "~/lib/road-graph/Intersection";
import LinkedVertex from "~/lib/road-graph/LinkedVertex";
import SegmentGroup from "~/lib/road-graph/SegmentGroup";
import RBush from 'rbush';
import {RBush} from 'rbush-rs';

interface Group {
roads: Road[];
Expand Down Expand Up @@ -45,14 +45,15 @@ export default class RoadGraph {
}

public initIntersections(): void {
type IntersectionItem = {
minX: number;
minY: number;
maxX: number;
maxY: number;
data: [LinkedVertex, Road][];
};
for (const group of this.groups.values()) {
const tree: RBush<{
minX: number;
minY: number;
maxX: number;
maxY: number;
data: [LinkedVertex, Road][];
}> = new RBush();
const tree = new RBush();

for (const road of group.roads) {
for (const vertex of road.vertices) {
Expand All @@ -62,7 +63,7 @@ export default class RoadGraph {
minY: pos.y - 0.01,
maxX: pos.x + 0.01,
maxY: pos.y + 0.01
});
}) as IntersectionItem[];

if (query.length > 0) {
const data = query[0].data;
Expand Down
4 changes: 4 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const VERSION = require('./package.json').version;

module.exports = (env, argv) => ([{
entry: './src/app/App.ts',
experiments: {
asyncWebAssembly: true,
// syncWebAssembly: true, // Optional, depending on your setup
},
output: {
filename: './js/index.[contenthash].js',
path: path.resolve(__dirname, 'build')
Expand Down