Skip to content

Commit 159a509

Browse files
authored
Feature/improve bboxselector performance (#1)
* feat: enhance BboxSelector component with marker support for improved positioning; refactor scaling and dragging logic * feat: integrate MlGeoJsonLayer into App component; enhance BboxSelector marker visibility and positioning logic * feat: update BboxSelector to use topLeft instead of center for positioning; adjust related calculations and effects * feat: add TerraBboxSelector and NewBboxSelector components; integrate terra-draw for enhanced bbox selection functionality * feat: enhance NewBboxSelector with edit mode support; integrate MlGeoJsonLayer for improved bbox visualization * feat: update BboxSelector to adjust element styling and position logic; ensure bbox updates correctly on size changes * fiix bbox selector scaling * remove unnecessary code from bboxselector * refactor: update BboxSelector options to make topLeft optional and improve element initialization logic * feat: enhance BboxSelector with edit mode support and integrate MlGeoJsonLayer for improved bbox visualization * feat: enhance BboxSelector with isMounted ref and improve target dimension updates with retry mechanism * feat: enhance BboxSelector with viewport state management and improve target dimension updates * fix: correct modeRef initialization and improve viewport state handling in BboxSelector * feat: implement BboxSelectorEditMode component for enhanced bbox editing functionality * fix: remove unused NewBboxSelector component and clean up BboxSelectorEditMode and BboxSelector styles * feat: add bbox update method to BboxSelector and adjust map zoom on city selection * fix: add outDir to TypeScript plugin configuration in rollup config
1 parent 576ad81 commit 159a509

File tree

10 files changed

+773
-382
lines changed

10 files changed

+773
-382
lines changed

package-lock.json

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

packages/stlmaps-app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"react": "^19.0.0",
2020
"react-admin": "^5.6.4",
2121
"react-dom": "^19.0.0",
22+
"terra-draw": "^1.4.3",
23+
"terra-draw-maplibre-gl-adapter": "^1.0.3",
2224
"three": "^0.174.0",
2325
"three-csg-ts": "^3.2.0",
2426
"zustand": "^5.0.3"

packages/stlmaps-app/src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@
3939

4040
.read-the-docs {
4141
color: #888;
42-
}
42+
}

packages/stlmaps-app/src/App.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import MobileMenu from "./components/MobileMenu";
1919
import MapSection from "./components/MapSection";
2020
import ModelSection from "./components/ModelSection";
2121
import { Feature } from "geojson";
22+
import { MlGeoJsonLayer } from "@mapcomponents/react-maplibre";
23+
import TerraBboxSelector from "./components/TerraBboxSelector";
24+
import NewBboxSelector from "./components/NewBboxSelector";
2225

2326
const mapCenter: [number, number] = [-74.00599999999997, 40.71279999999999];
2427
const SIDEBAR_WIDTH = 440;
@@ -45,12 +48,13 @@ const App: React.FC = () => {
4548
const {
4649
terrainSettings,
4750
buildingSettings,
48-
setBbox
51+
setBbox,bbox
4952
} = useLayerStore();
5053

5154
// Handle city selection to update both center and bbox
5255
const handleCitySelect = (city: any) => {
5356
if (city) {
57+
_map.setZoom(14);
5458
setBboxCenter(city.coordinates);
5559

5660
// Add a small delay to ensure state is updated before triggering bbox update
@@ -156,15 +160,14 @@ const App: React.FC = () => {
156160
open={openTodoList}
157161
onClose={() => setOpenTodoList(false)}
158162
/>
159-
<GenerateMeshButton /> <BboxSelector
163+
<GenerateMeshButton />
164+
<BboxSelector
160165
ref={bboxSelectorRef}
161166
options={{
162-
center: bboxCenter,
163167
scale: [1, 1],
164168
rotate: 0,
165-
orientation: "portrait",
166-
width: 800,
167-
height: 800,
169+
width: 200,
170+
height: 200,
168171
}}
169172
onChange={(geojson) => {
170173
console.log("BboxSelector onChange triggered with:", geojson);

0 commit comments

Comments
 (0)