Commit Graph

54 Commits

Author SHA1 Message Date
Evan Simkowitz
383a71fc25
Fix infinite loop in layoutAtom, improve iconbutton disable code (#306)
Fixes an infinite loop in the layoutModel atom synchronization that
would cause the atom to update indefinitely when the root node is
deleted.

Also adds a dedicated `disabled` flag for the IconButton decl so we can
disable the onClick handler when the button is disabled.

Also updates the Magnify toggle button to use this new flag, so that
when there's only one leaf in a layout, the magnify button is disabed.
2024-09-03 11:24:45 -07:00
sawka
70ef76be62 implement cmd:i, hook up telemetry switch, fix some settings types 2024-09-02 20:21:35 -07:00
Evan Simkowitz
aab487541b
Resolve BlockNum in WSH commands (#301) 2024-08-30 20:20:25 -07:00
Evan Simkowitz
cb664cff41
ignore prefers-reduced-motion for resize handle line delay 2024-08-30 12:52:02 -07:00
Evan Simkowitz
86d6c5cd60
set prefers-reduced-motion as a global override 2024-08-30 12:48:06 -07:00
Evan Simkowitz
3f4026a6b7
fix resize handle transition timing 2024-08-30 12:45:12 -07:00
Evan Simkowitz
e9b78c354f
Resize handle improvements (#299)
Adds a delay to the resize handle line first showing so it doesn't flicker when the mouse briefly passes over it. Also removes an unnecessary findNode call that was happening on every move. Also adjusts the pointer offset based on the display container bounding rect.
2024-08-30 12:31:03 -07:00
Evan Simkowitz
87d69eb5bc
fix treereducer getting out of sync 2024-08-29 12:38:13 -07:00
Evan Simkowitz
c9a1e9afe3
fix drag overlay losing rect changes 2024-08-28 16:24:25 -07:00
Evan Simkowitz
59979b13e7
use linear timing function for layout transitions 2024-08-28 14:25:47 -07:00
Evan Simkowitz
099c196cae
Use transition events to better-coordinate debouncing of NodeModel innerRect (#288)
Rather than using a timeout to debounce changes to the
NodeModel.innerRect, I'll use a transition event on the display
container. This way, if the user disables transitions using the reduced
motion setting, changes to the innerRect value will not be debounced.
2024-08-28 13:28:49 -07:00
Evan Simkowitz
fb65ec1e23
Explicitly set focus on insert (#285)
Adds a flag to the insert layout action to explicitly set the focus of a
newly inserted node. This also adds a flag in the starter layout to
focus on the terminal block.
2024-08-27 23:16:07 -07:00
Evan Simkowitz
c9c555452a
Establish wlayout for coordinating backend layout actions (#282) 2024-08-27 18:38:57 -07:00
Evan Simkowitz
7d90a3912b
fix nullref in layoutNode.findNode 2024-08-27 13:48:53 -07:00
sawka
730c0b1eea fix nullptr for non-focused node 2024-08-27 13:45:05 -07:00
Evan Simkowitz
c892c39a73
Fix block content sizing (#280)
Make the block content sizing update once when its node moves or becomes
magnified. By manually updating this inner sizing rather than letting
the block flow in the DOM, the animations of the block frames are much
smoother.

This also fixes an issue where two scrollbars were being rendered for
the Directory Preview widget.

This also sets zero padding on nodes when there's only a single node
being rendered.
2024-08-27 13:41:36 -07:00
Evan Simkowitz
8fcc856740
fix node collapse edge case 2024-08-27 13:25:02 -07:00
Evan Simkowitz
fac706fb4f
remove .js from imports 2024-08-26 16:37:05 -07:00
Evan Simkowitz
56757e4bb0
fix layoutTree tests 2024-08-26 16:35:35 -07:00
Evan Simkowitz
cefc491bf2
fix layoutNode and layout util tests 2024-08-26 16:27:57 -07:00
Evan Simkowitz
eea57af80b
Fix Cmd-W to close focused node (#273)
Fixes the in-memory focused node stack so it can be used to find the currently-focused node. This is necessary for `closeFocusedNode` to work.  Also fixes `validateFocusedNode` so it will set the first node to be focused if no focused node is available. Also cleans up leafOrder update pattern.
2024-08-26 12:32:28 -07:00
Evan Simkowitz
164afeeb66
Unified node model to pass data from layout to blocks (#259)
This adds a new NodeModel, which can be passed from the TileLayout to
contained blocks. It contains all the layout data that the block should
care about, including focus status, whether a drag operation is
underway, whether the node is magnified, etc.

This also adds a focus stack for the layout, which will let the focus
switch to the last-focused node when the currently-focused one is
closed.

This also addresses a regression in the resize handles that caused them
to be offset from the cursor when dragged.

---------

Co-authored-by: sawka <mike.sawka@gmail.com>
2024-08-26 11:56:00 -07:00
Evan Simkowitz
7c03a58b1b
don't set ready in effect 2024-08-22 19:26:22 -07:00
Evan Simkowitz
d5140129cd
Fix block numbering and switching with arrow keys (#258) 2024-08-21 17:43:11 -07:00
Evan Simkowitz
23261a7a98
Add flag for specifying a new node as magnified on insert (#253) 2024-08-20 20:14:14 -07:00
Evan Simkowitz
bd4bf93d4a
Update copyright indicators on a bunch of files (#255) 2024-08-20 17:01:29 -07:00
Evan Simkowitz
319d84d0b5
remove layout Dimensions declaration in favor of global 2024-08-19 14:33:44 -07:00
Evan Simkowitz
6df50a5790
use one multiply instead of two divide for minnodesize calc 2024-08-17 00:15:03 -07:00
Evan Simkowitz
c8d32c1668
set min resize size for nodes 2024-08-17 00:13:55 -07:00
Evan Simkowitz
07a843f7bd
render resize handles first so they can't interfere with a magnified block 2024-08-17 00:02:08 -07:00
Evan Simkowitz
7a1a3a2bea
fix addl props nullref 2024-08-16 17:59:53 -07:00
Evan Simkowitz
d73bcb82ea
fix last-magnified node logic 2024-08-16 12:21:44 -07:00
Evan Simkowitz
b0a09db4d1
Fix Cmd:W to delete block (#238) 2024-08-16 11:40:10 -07:00
Evan Simkowitz
42cc9f5d18
disable drag when there's a magnified node 2024-08-15 15:03:15 -07:00
Evan Simkowitz
c187059c8f
Fix flicker when dragging a node through a node gap (#231)
This simplifies the rect calculations by making the gap between pixels
into a padding applied directly to the leaf nodes. This means the gaps
won't be present in the overlay layer, so when dragging a node around it
is always over an OverlayNode and the pendingAction won't be unset.

Also simplifies onDrop handling
2024-08-15 14:53:13 -07:00
Evan Simkowitz
9fa11ff838
Fix tab switching issues with layout model (#230) 2024-08-15 13:45:45 -07:00
Evan Simkowitz
fc7bb7eaca
Clean up and document the layout model code (#229) 2024-08-15 12:24:06 -07:00
Evan Simkowitz
b5c6c1a937
Create reduced motIon setting (#226)
Adds a new setting that emulates the prefers-reduced-motion media query, allowing users to disable Wave animations without affecting other apps on their system. It also honors the prefers-reduced-motion query in case a system-level configuration is present.
2024-08-14 21:47:09 -07:00
Evan Simkowitz
3c9b3423a9
update type defs 2024-08-14 19:43:25 -07:00
Evan Simkowitz
15cd0b2477
fix resize handle drag offset 2024-08-14 19:37:47 -07:00
Evan Simkowitz
a95f60469a
rename vars 2024-08-14 19:27:32 -07:00
Evan Simkowitz
fb1c3ac85f
update var name 2024-08-14 19:09:22 -07:00
Evan Simkowitz
8262f977f0
remove unused layout tree reducer 2024-08-14 18:44:32 -07:00
Evan Simkowitz
e85b0d205e
New layout model (#210)
This PR is a large refactoring of the layout code to move as much of the
layout state logic as possible into a unified model class, with atoms
and derived atoms to notify the display logic of changes. It also fixes
some latent bugs in the node resize code, significantly speeds up
response times for resizing and dragging, and sets us up to fully
replace the React-DnD library in the future.
2024-08-14 18:40:41 -07:00
Evan Simkowitz
9e1460b9e1
Remove UUID library in favor of Crypto (#221)
This PR swaps usage of the `uuid` library for the built-in
`crypto.randomUUID` function, which is available in both NodeJS and the
browser. The built-in function is around 12x faster than the `uuid`
library. The strings produced by the built-in function are fully
compatible with the UUIDv4 standard, so it's an easy switch.
2024-08-12 21:20:13 -07:00
Evan Simkowitz
e29cb2debe
Make magnify icon always visible, transition from magnify to minimize (#197)
I'm updating the magnify button to be always visible and animate a
transition between being a "Magnify" button and a "Minimize" button.

This also cleans up some text shrinking behavior in the block frame
header so the end icons are always visible.

Also fixes some height discrepancies in the block frame header.

Also implements a `prefers-reduced-motion` query for the tilelayout and
block frame to ensure transitions are not set if the user does not want
them.
2024-08-05 16:13:26 -07:00
Evan Simkowitz
74e86ef0cc
Bootstrap layout on first launch (#186) 2024-07-31 21:27:46 -07:00
Evan Simkowitz
c91cae9463
Fix some more improper border radii (#184) 2024-07-31 13:37:20 -07:00
Evan Simkowitz
2157df85de
Disable block pointer events during layout drag (#183)
This will ensure that the webview cannot capture the pointer events and
disrupt the drag functionality.

This also fixes an issue where greedy and imprecise bounds calculations
could result in thrashing of the layoutState.pendingAction field, which
could cause the placeholder to flicker.

This also fixes issues where some React Effects that were supposed to be
debounced or throttled were being invoked too much. This is because
useEffect regenerates the callback when it is run, resulting in the
debounce or throttle never taking effect. Moving the throttled or
debounced logic to a separate callback solves this.
2024-07-31 12:49:38 -07:00
Evan Simkowitz
9afb5a7bc1
Update setTransform calculation to ensure blocks don't overflow display container (#181) 2024-07-30 19:21:06 -07:00