Skip to content

Commit 83cf0ec

Browse files
aleksprogergithub-actions[bot]
authored andcommitted
Make indoor selector reflect design mocks (internal-6120)
GitOrigin-RevId: 3ffe60fe72838042994756ec7c97ec4b5c42cfb5
1 parent 733cca0 commit 83cf0ec

7 files changed

Lines changed: 284 additions & 125 deletions

File tree

debug/indoor.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
partialScreenContainer.style.backgroundColor = 'rgba(255, 165, 0, 0.2)'; // Very light orange background
6060
partialScreenContainer.style.pointerEvents = 'none';
6161
partialScreenContainer.style.zIndex = '999';
62-
document.body.appendChild(partialScreenContainer);
6362

6463
// Create the map
6564
var map = window.map = new mapboxgl.Map({

debug/indoor/indoor_style.js

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const indoorLayers = [
1717
"minzoom": 16.0,
1818
"filter": [
1919
"all",
20+
[ ">", ["length", ["config", "mbx-indoor-level-selected"]], 0],
2021
["==", ["get", "shape_type"], "building"],
2122
],
2223
"layout": {
@@ -32,13 +33,22 @@ const indoorLayers = [
3233
"slot": "middle",
3334
"filter": [
3435
"all",
36+
[ ">", ["length", ["config", "mbx-indoor-level-selected"]], 0],
3537
["==", ["geometry-type"], "Polygon"],
3638
["in", ["get", "shape_type"], ["literal", ["building"]]],
3739
],
3840
"paint": {
3941
// Note: We should keep opacity above zero to enable queries of the footprint
4042
"fill-extrusion-color": "#fbfbfb",
41-
"fill-extrusion-opacity": 0.6,
43+
"fill-extrusion-opacity": [
44+
"interpolate",
45+
["linear"],
46+
["zoom"],
47+
16,
48+
0,
49+
16.5,
50+
0.8
51+
],
4252
"fill-extrusion-height": 1
4353
}
4454
},
@@ -48,7 +58,7 @@ const indoorLayers = [
4858
"id": "building-outline",
4959
"source": "indoor-source",
5060
"source-layer": "indoor_structure_metadata",
51-
"minzoom": 16.0,
61+
"minzoom": 15.0,
5262
"slot": "middle",
5363
"filter": [
5464
"all",
@@ -58,7 +68,7 @@ const indoorLayers = [
5868
"paint": {
5969
// Note: We should keep opacity above zero to enable queries of the footprint,
6070
// Keep 0.01 do be not visible, 0.1 useful to debug and see metadata geometries
61-
"fill-opacity": 0.1,
71+
"fill-opacity": 0.01,
6272
"fill-color": "#e8a5b8"
6373
}
6474
},
@@ -68,7 +78,7 @@ const indoorLayers = [
6878
"id": "floor-outline",
6979
"source": "indoor-source",
7080
"source-layer": "indoor_floor_metadata",
71-
"minzoom": 16.0,
81+
"minzoom": 15.0,
7282
"slot": "middle",
7383
"filter": [
7484
"all",
@@ -85,7 +95,7 @@ const indoorLayers = [
8595
"id": "floor-current",
8696
"source": "indoor-source",
8797
"source-layer": "indoor_floor",
88-
"minzoom": 16.0,
98+
"minzoom": 15.0,
8999
"slot": "middle",
90100
"filter": isSelectedFloorBase(),
91101
"paint": {
@@ -139,7 +149,7 @@ const indoorLayers = [
139149
["zoom"],
140150
16,
141151
0,
142-
17,
152+
16.5,
143153
1
144154
],
145155
"fill-extrusion-color": [
@@ -187,7 +197,7 @@ const indoorLayers = [
187197
["zoom"],
188198
16,
189199
0,
190-
17,
200+
16.5,
191201
0.4
192202
],
193203
"line-color": "#a3a3d1"
@@ -214,7 +224,7 @@ const indoorLayers = [
214224
["zoom"],
215225
16,
216226
0,
217-
17,
227+
16.5,
218228
1
219229
],
220230
"fill-extrusion-color": "hsl(250, 75%, 90%)",
@@ -248,7 +258,7 @@ const indoorLayers = [
248258
["zoom"],
249259
16,
250260
0,
251-
17,
261+
16.5,
252262
0.2
253263
],
254264
"fill-extrusion-color": "#f8cf7e",
@@ -303,6 +313,15 @@ const indoorLayers = [
303313
"paint": {
304314
"text-halo-color": "#ffffff",
305315
"text-halo-width": 1.3,
316+
"text-opacity": [
317+
"interpolate",
318+
["linear"],
319+
["zoom"],
320+
17,
321+
0,
322+
17.5,
323+
1
324+
],
306325
"text-color": [
307326
"case",
308327
["match", ["get", "class"], ["retail"], true, false],
@@ -336,6 +355,15 @@ const indoorLayers = [
336355
},
337356
"paint": {
338357
"text-color": "hsl(0, 0%, 0%)",
358+
"text-opacity": [
359+
"interpolate",
360+
["linear"],
361+
["zoom"],
362+
16,
363+
0,
364+
16.5,
365+
1
366+
],
339367
"text-translate": [0, 0]
340368
}
341369
},
@@ -368,7 +396,16 @@ const indoorLayers = [
368396
"paint": {
369397
"text-halo-color": "#ffffff",
370398
"text-halo-width": 1.3,
371-
"text-color": "hsl(0, 0%, 0%)"
399+
"text-color": "hsl(0, 0%, 0%)",
400+
"text-opacity": [
401+
"interpolate",
402+
["linear"],
403+
["zoom"],
404+
16,
405+
0,
406+
16.5,
407+
1
408+
],
372409
}
373410
},
374411
];
@@ -407,6 +444,7 @@ const style = {
407444
"building_ids": ["get", "building_ids"],
408445
"type": ["get", "type"],
409446
"name": ["get", "name"],
447+
"short_name": ["get", "short_name"],
410448
"z_index": ["get", "z_index"],
411449
"connected_floor_ids": ["get", "connected_floor_ids"],
412450
"conflicted_floor_ids": ["get", "conflicted_floor_ids"]

src/css/mapbox-gl.css

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -825,30 +825,38 @@ a.mapboxgl-ctrl-logo.mapboxgl-compact {
825825
touch-action: pan-x pan-y;
826826
}
827827

828+
.mapboxgl-ctrl-separator {
829+
height: 1px;
830+
background-color: #e0e0e0;
831+
}
832+
828833
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button {
829-
width: auto;
830-
height: auto;
831-
padding: 5px 10px;
832-
font-size: 12px;
833-
line-height: 1.5;
834834
color: #333;
835-
background-color: #fff;
836-
border: 1px solid #ccc;
837-
border-radius: 4px;
838-
margin: 2px;
839-
cursor: pointer;
835+
font-size: 18px;
836+
width: 44px;
837+
height: 44px;
838+
font-weight: bold;
839+
}
840+
841+
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:first-child {
842+
border-top-left-radius: 8px;
843+
border-top-right-radius: 8px;
844+
}
845+
846+
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:last-child {
847+
border-bottom-left-radius: 8px;
848+
border-bottom-right-radius: 8px;
840849
}
841850

842851
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button:hover {
843-
background-color: #f0f0f0;
852+
background-color: #f5f5f5;
844853
}
845854

846855
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected {
847-
background-color: #4264FB;
856+
background-color: #4a5568;
848857
color: #fff;
849-
border-color: #4264FB;
850858
}
851859

852860
.mapboxgl-ctrl button.mapboxgl-ctrl-level-button-selected:hover {
853-
background-color: #3151d9;
861+
background-color: #2d3748;
854862
}

src/style/indoor_features_storage.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ export default class IndoorFeaturesStorage {
1010
this._buildings = new Map();
1111
}
1212

13-
append(indoorData: IndoorData) {
13+
append(indoorData: IndoorData): boolean {
1414
const building = indoorData.building;
15-
const buildingId = building.properties.id as string;
16-
if (buildingId) {
17-
this._buildings.set(buildingId, building);
15+
let hasChanges = false;
16+
if (building) {
17+
const buildingId = building.properties.id as string;
18+
if (buildingId) {
19+
this._buildings.set(buildingId, building);
20+
if (!hasChanges && !this._buildings.has(buildingId)) {
21+
hasChanges = true;
22+
}
23+
}
1824
}
1925

2026
indoorData.floors.forEach(newFloor => {
21-
this._floors.set(newFloor.properties.id as string, newFloor);
27+
const floorId = newFloor.properties.id as string;
28+
if (!hasChanges && !this._floors.has(floorId)) {
29+
hasChanges = true;
30+
}
31+
this._floors.set(floorId, newFloor);
2232
});
33+
34+
return hasChanges;
2335
}
2436

2537
clear() {
@@ -28,16 +40,19 @@ export default class IndoorFeaturesStorage {
2840
}
2941

3042
getFloors(buildingId: string | null = null): Array<TargetFeature> {
43+
const floorFeatures = Array.from(this._floors.values());
3144
if (buildingId) {
32-
return Array.from(this._floors.values()).filter(floor => {
45+
const floors = floorFeatures.filter(floor => {
3346
const buildingIds = floor.properties.building_ids as string;
3447
if (!buildingIds) {
3548
return false;
3649
}
3750
const buildingIdsArray = buildingIds.split(';');
38-
return buildingIdsArray.includes(buildingId);
51+
const isBuildingId = buildingIdsArray.includes(buildingId);
52+
return isBuildingId;
3953
});
54+
return floors;
4055
}
41-
return Array.from(this._floors.values());
56+
return floorFeatures;
4257
}
4358
}

0 commit comments

Comments
 (0)