Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ElementInstanceMetadata.localFrame. (#6256)
**Problem:** It would appear that we don't _really_ need `ElementInstanceMetadata.localFrame` and can instead easily calculate it. **Fix:** The supposition that we don't need `localFrame` was actually true, it can instead be calculated comparatively simply from the `globalFrame` of the target and that of one of the ancestors. Originally it was thought that the latter would be the parent and in most cases it is, however if the target is the root component of an instance, then the parent will have an identical value for `globalFrame` and instead we need the grandparent of the target. **Commit Details:** - Removed the field `localFrame` from `ElementInstanceMetadata` and also from the relevant factory function. - Included the whole editor metadata in the metadata that `pressKeys` creates so that it's possible to obtain the element metadata for the parent. - Replaced lookups of `localFrame` with calls to `MetadataUtils.getFrame`. - Implemented `MetadataUtils.getFrame` to lookup the global frames for an element and its parent (mostly) and to then calculate the local frame from their difference. **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Preview mode
- Loading branch information