When a space is moved, or added to, or another space is drawn next to it (causing edges to split), the edge_ids will change. Since windows are associated by reference to an edge, we need some way to carry them along.
NatLabRockies/floorspace.js#17
If an edge is deleted, then windows on that edge are deleted.
If an edge is resized, windows should stay in the same absolute location. If a window's alpha parameter becomes <= 0 or >= 1 the window should be deleted.
If an edge is broken into two pieces (e.g. by inserting a vertex), windows should be moved to the correct edge such that alpha remains <= 0 or >= 1
What if we record the locations of all components before a replaceFacePoints, then put them back as if we were creating them anew after the new face exists.
- Works okay for adding new sections to a space, but what about moving one?
- Maybe there isn't an edge anymore after we've made the face updates: https://trello-attachments.s3.amazonaws.com/58d428743111af1d0a20cf28/59baae015b7f9d6ce73531ad/23278d4eddd900cb0bf770ca9e805ecd/recording.webm
Somehow figure out a mapping from the existing edges to the replacements. Go through and update the windows to refer to the new edges.
- We sometimes have to change alpha, the pct distance along the referenced edge, if an edge has grown: https://trello-attachments.s3.amazonaws.com/58d428743111af1d0a20cf28/59baaf84d7a2d6a828716241/645046cfaa8f0334e44cdb0b5f3594d6/recording.webm
- Who owns this edge? https://trello-attachments.s3.amazonaws.com/58d428743111af1d0a20cf28/59baafe8fca701a5af94585e/72a6c8da397a4db41edb0e0f31f51923/recording.webm
// src/store/modules/geometry/actions/actions.js
replaceFacePoints(context, { geometry_id, face_id, vertices, edges }) {
// get all components
context.commit('replaceFacePoints', {
geometry_id,
face_id,
// the new geometry that is replacing the existing stuff.
vertices,
edges,
});
// replay the components
},
do the
record and replace, but only put an edge back if it's going to live on the same face as when we started.When we run moveByOffset, replace with an offset.