Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Epic street editing #989

Merged
merged 67 commits into from
Jan 13, 2025
Merged

Epic street editing #989

merged 67 commits into from
Jan 13, 2025

Conversation

kfarr
Copy link
Collaborator

@kfarr kfarr commented Dec 26, 2024

No description provided.

kfarr and others added 30 commits December 24, 2024 20:36
accepts type and index; does not yet accept custom object to represent segment and its constituent components; doesn't appear to apply child components correctly
-- instead look at working code to create new street-segments from an object in street-segment.js

to test, run on console:
> document.querySelector('[managed-street]').components['managed-street'].insertSegment(3, 'bike-lane');
as a user i can detach a clone and the action is undo-able. if i save and reload I cannot undo or reattach the component unless i choose to add a new clone component or reset the segment completely.
Co-Authored-By: Ben Kovitz <bkovitz@gmail.com>
Co-Authored-By: Ben Kovitz <bkovitz@gmail.com>
Co-Authored-By: Ben Kovitz <bkovitz@gmail.com>
…Managed-Street-format

Converting default streets to managed street format
Copy link
Collaborator

@vincentfretin vincentfretin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using events is indeed better here. You can probably simplify the code just listening on segment-width-changed on the parent entity, the event bubbles from the segment to the parent that is the managed-street entity.
Be careful to properly bind the listener function and use the same function when you remove the listener.

src/components/polygon-offset.js Outdated Show resolved Hide resolved
src/components/polygon-offset.js Outdated Show resolved Hide resolved
src/components/street-align.js Outdated Show resolved Hide resolved
src/components/street-align.js Outdated Show resolved Hide resolved
src/components/street-ground.js Outdated Show resolved Hide resolved
src/editor/components/components/Sidebar.js Outdated Show resolved Hide resolved
src/components/managed-street.js Outdated Show resolved Hide resolved
src/components/managed-street.js Outdated Show resolved Hide resolved
src/components/managed-street.js Outdated Show resolved Hide resolved
src/components/street-align.js Show resolved Hide resolved
kfarr added 10 commits January 8, 2025 09:54
fix binding

I have to keep this in or it raises an error `Cannot read properties of undefined (reading 'width')`. My guess is there is a race condition such that when the scene is loaded the dom attribute is added but the a-frame component hasn't been initialized thus the segment is returned as matching the querySelector but not from a-frame getattribute? I changed the logic a bit to check if the street-segment component exist and to also return if no width for a segment:
```
      const segmentWidth = segmentEl.getAttribute('street-segment')?.width;
      if (!segmentWidth) return;
```
remove old streetplan loader
@kfarr kfarr marked this pull request as ready for review January 13, 2025 22:18
@kfarr kfarr merged commit 9e9b160 into main Jan 13, 2025
1 check passed
@kfarr kfarr deleted the epic-street-editing branch January 13, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants