Hey Everyone,
I’m working on an interactive map-based selection system in Bubble, where users can click on buildings (like “Car Showroom” or “Repair Shop”) to select and highlight them (please see attached image). Here’s how I want it to work:
- Users click on a building (a shape on the map).
- The building highlights visually (e.g., background changes color).
- A custom state updates with the name of the selected building.
- Clicking the same building again unselects it (removing the highlight and clearing the custom state).
Here’s my current setup:
-
Custom State:
Name:SelectedShape
Type:text
Attached to: The parent element containing the map and shapes.
Default Value: Empty (""
). -
Workflows:
Workflow 1 (Selecting a Building):
Trigger: When a shape (e.g.,Car_Showroom
) is clicked.
Action: SetSelectedShape
to"CarShowroom"
.
Only When:SelectedShape
is not"CarShowroom"
.Workflow 2 (Deselecting a Building):
Trigger: When the same shape is clicked.
Action: SetSelectedShape
to""
.
Only When:SelectedShape
is"CarShowroom"
. -
Conditional Formatting:
Condition: WhenSelectedShape
is"CarShowroom"
.
Appearance: Background color changes to blue, and opacity is set to 100%.
The Problem:
- The custom state doesn’t seem to update consistently when clicking the shapes.
- The conditional formatting doesn’t trigger reliably.
I’ve double-checked the workflows and conditions, but it still doesn’t work as expected.
Questions:
- Are there any common issues or conflicts I might be missing in setting custom states and conditional formatting for shapes?
- Is there a better way to handle selection and highlighting of multiple shapes on a map?
- Has anyone built a similar system in Bubble? If so, can you share any tips or resources?
Any help or guidance would be greatly appreciated! Thanks in advance.