Add separate control panel#417
Add separate control panel#417edwardhorsford wants to merge 2 commits intoPattern-Projector:betafrom
Conversation
|
@edwardhorsford is attempting to deploy a commit to the Courtney Pattison's projects Team on Vercel. A member of the Team first needs to authorize it. |
c7fc7ec to
aae6dce
Compare
|
Pushed a fix to some performance issues I noticed - things should be much speedier now. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you so much for this, @edwardhorsford! It’s an impressive amount of work. After thinking about the control panel idea for a few days, I’m actually leaning toward a simpler screen mirroring option. Instead of maintaining a completely different UI for the control panel (which adds a lot of complexity and duplication), I think it’d be much more maintainable to just mirror the existing UI across tabs. Since we already have the "zoom out" view—which is essentially a minimap—we can focus our energy on making the main UI better for everyone. For example, if we move toward a responsive, reflowing, or draggable menu, that solves the problem for both the "controller" tab and for people just using the app on a single screen or mobile device. (Though I know I still need to fix how zoom out works currently in #379!) A few thoughts on your ideas: Separate Devices: It would be awesome to get this working on a phone/tablet! I’m hesitant to host anything that touches user data, as I want to keep PP strictly client-side. But even just an educational resource or a local-network sync guide would be a huge win. Marking off pieces: A lot of people use the line tool for this. I actually do the opposite: I draw lines on the grainlines of pieces I need to cut, then delete them as I go. It helps me align grainlines with my cutting mat and keeps a "countdown" of what’s left. Mobile/Layout: I see why you went for the single-column layout—it’s much better for mobile. I’d love to take that inspiration and apply it to a responsive design for the main site, rather than maintaining two separate versions. What do you think about focusing the "bridge" logic on syncing the state between two identical tabs instead? That way, we get the functionality you're looking for with a fraction of the code to maintain. |
Pull Request Checklist
yarn buildto ensure that the project builds successfully.CHANGELOG.mdwith the necessary changes made in this pull request.Description
This PR replicates the PR I made on my fork of this repo, though with some changes caused by rebasing against the beta branch and removing the settings menu I had added.
The PR adds a secondary "control panel" window. This allows users to control Pattern Projector from a separate screen (like a laptop) while the main window is projected, avoiding the need to interact directly with the projected display.
Replicates most UI functions from the main window to the control panel with the exception of full screen (which had some security issues and didn't work reliably for me).
Has some two new features including:
@courtneypattison Happy to attempt to make any changes you request. Or if you'd like to take this over and make your own changes, that's also cool. I hope it might serve as inspiration for the future even if you decide this PR isn't one you want to merge.
How it works
Inter-window Communication - The control panel and main window communicate via the BroadcastChannel API. A bridge component in the main window listens for actions from the control panel, executes them using the existing transform logic, and broadcasts state updates back. This avoids duplicating any business logic.
Viewport Calculation - The preview needs to know what portion of the PDF is visible. The bridge calculates this by transforming screen corners through the inverse of the combined projection matrices, then extracting the bounding box and rotation.
Thumbnail Generation - The PDF preview is generated by rendering all stitched pages at 3x the target resolution, applying line thickening based on the line thickness setting, then scaling down with a threshold filter. The result is cached so toggling the preview doesn't trigger re-rendering.
File Transfer - Browsers block programmatic file input clicks from other windows, so the control panel reads selected files as ArrayBuffers and transfers them via the broadcast channel. The main window reconstructs the File object and loads it normally.
Other details
Testing
I've been developing on MacOS with Safari and Arc (Chromium based browser) - and it seems to work. Panning can be a bit slow - but I think the main app was already somewhat slow to pan.
As mentioned in #416 this is mostly LLM coded. I've tested manually but whilst I can code I am not familiar with typescript.
I've only got a handful of pattern pdfs to try and it could do with being tested in more. The preview needs to render from the pdf so it would be good to try other versions. I've tested single and multi-layered, and made sure to regenerate when layers are disabled.
I've not explored the stitch menu.
Related Issues
#416 and perhaps #393
TODO
Ideas for the future