backends: per-node frame reporting for drive coordinate taps - #60
Merged
Merged
Conversation
LUIAppleBackend collects every rendered node's frame (global coordinate
space, via onGeometryChange on the single LUIAnyNodeView choke point)
and emits the full map once per coalesced layout flush through
onFramesReport while frameReportingEnabled is on. emitFramesSnapshot()
pushes the current table for late-attaching drivers.
The Flutter backend does the same via a _FrameProbe element table and a
post-frame measure loop that re-measures every frame while enabled —
scrolling moves nodes without rebuilds.
Feeds drive's live-attach 'tap x y' hit-testing; hosts forward the map
to the live socket as {"frames":[[id,x,y,w,h],...]}.
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds an opt-in frame-reporting hook to both retained backends so a
drive --socketattach can hit-test coordinates (tap x y) against real layout geometry.LUIAppleBackend(macOS/iOS):frameReportingEnabledgates emission;onFramesReport: (([Int: CGRect]) -> Void)?delivers the full node-id → frame map once per coalesced layout flush (oneDispatchQueue.main.asynchop regardless of how many nodes moved).emitFramesSnapshot()re-pushes the current table — needed because a driver can attach after the runtime is already up.LUIFrameReportModifierhangs onLUIAnyNodeView, the single per-node choke point:onGeometryChangein.globalspace +onDisappearremoval. Collection is unconditional (a dict write per geometry change) so enabling mid-session sees the latest geometry without waiting for a relayout.LUIFlutterBackend(Android):frameReportingEnabled+onFrames: void Function(Map<int, Rect>)?._FrameProbewrapswidget()output and registers itsBuildContextin_frameProbes; a self-rearming post-frame callback measures every probe vialocalToGlobal(Offset.zero) & sizeeach frame while enabled — scrolling moves nodes without rebuilds, so a one-shot measure is not enough. Emits only when the map actually changed.Host contract: forward each snapshot to the live socket as
{"frames":[[id,x,y,w,h],...]}(see logseq/drive PR; tiensonqin/meng wires it for macOS). Web hosts can implement the same contract via DOM rects later.Verified end-to-end: Meng.app +
MENG_DRIVE_SOCKETstreams 40+ node frames andtapresolves/presses real controls.Link to Devin session: https://app.devin.ai/sessions/ae1476f4d79f40c0be25bb63fc36b0c5
Open in Devin Desktop: https://app.devin.ai/desktop/session/ae1476f4d79f40c0be25bb63fc36b0c5?variant=devin
Requested by: @tiensonqin