feat(editors/SingleLineDiagram) Allow movement of bays #478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow movement of bays, see #456
I will be very happy to take a review and make corrections. I will be happy to be educated. Perhaps I could convince @dlabordus to take a look (hi! 😉).
Note that I have used
SVGGraphicsElement
instead ofSVGElement
because many methods associated with graphical objects are not available in the TS types forSVGElement
(see MDN). I have resisted the urge to replace this more widely than required to satisfy the compiler.It seemed for the time being that the best way to access bay properties was on the bay text rather than the rectangle drawn for the bay as this overlaps other objects. This is not consistent with what is done elsewhere where we click on the graphic. Happy to take some ideas about a better approach.
The
ssd
file included on the issue might be helpful for tests.moving_bays.mp4
I'm not sure how to write a test but I'm happy to have a go.
Note: This works on "some bays" for me but not all of them, the
getBBox
appears not to always be correct -- I haven't yet looked into this.