Commit graph

139 commits

Author SHA1 Message Date
Tobias Hunger
c25d15c3d2 live-preview: Remember recent colors
... for the duration of the session. How can we save those
colors?

Recent colors change a lot, we probably do not want that stored
inside the git repository hosting the slint files... and this is
probably "personal data" and nor "project data" in the first place.
2025-05-22 15:30:30 +02:00
Nigel Breslaw
2c71c8539d
Make palette apply clicked colors (#8498) 2025-05-22 12:47:23 +03:00
Tobias Hunger
a90a986263 live_preview: Fuzzy-match palette entries 2025-05-22 09:46:30 +02:00
Nigel Breslaw
f06c8f8a85 Show basic palettes
Some checks are pending
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-05-21 16:28:03 +02:00
Simon Hausmann
904bc56e62 Introduce Platform.style-name
This replaces the previously hidden `StyleMetrics.style-name` that was only accessible for internal use.
2025-05-06 13:06:27 +02:00
Nigel Breslaw
22143a04ff
Tidy the brush pickers (#8277)
This refactor is to help make future maintenance easier.

Items are now consistently named as brush instead of color.
Instead of one huge brush picker file, various elements such as gradients live in their own file.
The brush picker is also made a bit less 'smart' and doesn't have to fully understand how the current color or brush needs to be updated or if the data tab live preview needs to be updated. In turn the PickerData has been made smarter and looks after these updates.

This has fixed a few bug regarding gradient stops.
2025-04-28 12:29:43 +03:00
Nigel Breslaw
c3ebe58359
Fix for missing gradient stop sliders (#8249) 2025-04-23 11:41:05 +03:00
Nigel Breslaw
e7fb9a324c
Fix for preview gradient suddenly becoming a solid color (#8245) 2025-04-23 01:18:39 +03:00
Nigel Breslaw
721de2a357
Get the table editor working with color/brush (#8243) 2025-04-22 23:55:35 +03:00
Nigel Breslaw
1800ed3018
Allow editing linear-gradient angle in floating picker (#8242) 2025-04-22 21:58:02 +03:00
Nigel Breslaw
6364f2ecc3
Fix brush editor contrast when using light mode (#8232) 2025-04-22 13:17:35 +03:00
Nigel Breslaw
413554268e
Clip FF from hex colors (#8225)
Although technically Slint hex colors are #RGBA values, it's common to not see the alpha when its 100% i.e. FF. So a color in code would look like #d1d1d1 and not #d1d1d1ff. However any hex color created by the live-preview components always shows the alpha even if it's 100%.

This change clips the FF from the values create via Slint code. However brush stops are created via Rust and need a separate fix.
2025-04-21 21:55:43 +03:00
Nigel Breslaw
5621c70373
Better handling of unset colors and brush properties (#8224)
Brush and color property widgets no longer show the default value of 'transparent' when a value has not been set. Instead the common symbol for no set color from other tools (a red diagonal line on a white background) is used.

When clicked the color picker is then shown and is populated with a default color that is 100% opaque.
2025-04-21 21:55:28 +03:00
Nigel Breslaw
7f352ed764
Fixes for gradient stop re-ordering (#8211)
Potential fix for a set of complex gradient stop re-ordering interactions.

Previously when dragging a gradient stop past other stops the items did not re-order as expcected. The current focused stop did not update. Stops could stick to the dragging stop. Stop sliders could disapear from view. These should be fixed but need more manual testing.
2025-04-20 17:02:49 +03:00
Nigel Breslaw
36bc0d1922
Teach new brush pickers to handle radial gradients (#8208)
This also includes some minor bug fixes:

Floating panels block scroll wheel events to stop the underlying canvas being scrolled.
Hex color value should be applied when defocusing the TextEdit,
2025-04-19 23:27:08 +03:00
Simon Hausmann
8761eaadeb
Move Palette.style-name to internal protected StyleMetrics.style-name (#8200)
This is only exposed when internal types are exposed (such as in the lsp).

The plan is to make this public under a new name/global after the release.

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-04-19 10:20:52 +02:00
Nigel Breslaw
ec1e125e80
Fix for unexpected gradient changes (#8188) 2025-04-17 00:14:31 +03:00
Tobias Hunger
ba19105238 live-preview: Allow to add gradient stops
* Using the `+` button, which will insert a new stop
  after the current stop
* By clicking on the gradinet Preview
2025-04-16 17:43:08 +02:00
Nigel Breslaw
076e933515
Fix out of sync propeties with new pickers (#8183) 2025-04-16 17:59:55 +03:00
Nigel Breslaw
efafb9d8b6
Datatab support for brush properties (#8181) 2025-04-16 17:34:51 +03:00
Nigel Breslaw
77baa2c93e
Gradient fixes (#8179)
Better align color and gradient indicators.
Fix pixel jump in hue slider.
Allow deleting of gradient stops.
Stop json error showing all the time.
2025-04-16 16:14:18 +03:00
Nigel Breslaw
7ae6212b0b
Visual color stop picker for gradient stops (#8173)
* Right align % text

* Show and hide visual color stop editor

* Working color stop picker
2025-04-16 12:59:09 +02:00
Tobias Hunger
1008e3e406 live-preview: "Fix" boolean not changing in table 2025-04-16 11:33:26 +02:00
Nigel Breslaw
ee0f4f65ab
Show which gradient stop has focus (#8167)
Also fixes that the gradient preview with the drag sliders should always show with a 90deg linear gradient.
2025-04-16 11:20:03 +03:00
Nigel Breslaw
74fb172ef3
Allow editing of a brush that is hex color value or linear gradient (#8164) 2025-04-16 09:59:11 +03:00
Tobias Hunger
647b4650a3 live-preview: Fix widgets in the edit window of the table sticking out on the side
The classic: Layouts distribute 100% of the pixels to their elements
and only then apply padding and spacing... when you use `width: 100%;`.
2025-04-15 18:56:27 +02:00
Tobias Hunger
de75b706e7 live-preview: Remove stray debug output 2025-04-15 18:56:27 +02:00
Tobias Hunger
3cdf786dba live-preview: Do not show "<MAIN>" in table edit window 2025-04-15 18:56:27 +02:00
Tobias Hunger
2512713a31 live-preview: Move more code out of ui.rs
... add unit tests and fix the bugs those discovered.
2025-04-15 16:34:44 +02:00
Nigel Breslaw
8f6f06f53d
live-preview inline color widget (#8156) 2025-04-15 17:19:38 +03:00
Tobias Hunger
30b5ed026b
live-preview: Keep gradient stops sorted (#8142)
live-preview: Keep gradient stops sorted

... when reading them from code and when inserting
new stops.

* live-preview: Add a API to move gradient stops

Gradient stops need to be sorted now, so we need to
have a new API for moving gradient stops -- so the
model can stay sorted as we drag stops around.
2025-04-15 10:03:35 +02:00
Nigel Breslaw
a7128a4d2d
Brush Picker limit hex input length (#8133)
If the # hex value gets longer than 8 characters it will reset to the previous valid value
2025-04-14 14:20:18 +03:00
Nigel Breslaw
5c6c8b74d7
TableEditor should not show add row on a struct (#8139) 2025-04-14 14:19:45 +03:00
Nigel Breslaw
ff04828466
live-preview color/brush picker allows hex values to be text editable (#8126)
* Allow stop and alpha % to be text editable

* Generalise PickerTextInput

* hex values are now text editable
2025-04-14 00:23:44 +03:00
Nigel Breslaw
1eab3eea9f
live-preview Color/Brush Picker looks wrong in light mode (#8125)
In dark mode the new picker looked fine, however in light mode text was misaligned and the brush mode icons were not visible. This PR fixes those issues.
2025-04-13 17:43:52 +03:00
Nigel Breslaw
2da6bf4add
live-preview data tab floating table editor (#8123)
Adds a table editor based on the color picker floating draggable panel.

This includes behaviours that keep the panel inside the bounds of the live preview window and light / dark mode.
2025-04-13 14:57:50 +03:00
Nigel Breslaw
cbb5b96ade
Refactor out a reusable DraggablePanel (#8111) 2025-04-11 16:07:08 +03:00
Nigel Breslaw
36c7dcaf81
New Brush widget (#8082) 2025-04-10 22:58:01 +03:00
Nigel Breslaw
8b7c61a9d3
Simplify the color picker window dragging (#8053)
The previous solution meant a hidden TouchArea the size of the live-preview handled dragging the color picker. This won't scale as now multiple pickers need to show for the brush picker gradient editor.

This change means the picker now handles the drag logic itself with it's own internal TouchArea.

This change also fixes an issue where moving the window very quickly showed a bug in the code that stops the window moving out side the bounds of the live-preview. It would stop, but too early with a few pixels to spare. Now the picker stops at the actual window bounds.
2025-04-04 00:38:13 +03:00
Nigel Breslaw
566b5ed889
Slight tweaks to prepare for the brush/gradient widget (#8046) 2025-04-03 16:07:18 +03:00
Nigel Breslaw
d607651fb1
Make the new color picker work in the data tab mode (#8030) 2025-04-02 21:55:49 +03:00
Nigel Breslaw
51f7834f56
fix: Reszing live-preview could leave the color picker off screen (#8018) 2025-04-01 20:21:21 +03:00
Nigel Breslaw
60234663ad
Add light mode style to color picker (#8016) 2025-04-01 18:53:33 +03:00
Nigel Breslaw
03c74383dc
nigel/picker-polish (#8015) 2025-04-01 17:38:36 +03:00
Nigel Breslaw
047377e94a
Simplify the live-preview widget layouts (#8011) 2025-04-01 15:50:05 +03:00
Nigel Breslaw
79382187ef
live-preview: Visual color picker (#7971) 2025-04-01 14:50:19 +03:00
Tobias Hunger
14b55e54b4 live-preview: Do not pass on signals from "invisible" widgets
This stops e.g. the color widget filling in default values for
empty strings.
2025-03-26 12:54:40 +01:00
szecket
d2e839a7c4 live-preview: Use context menu
... in the spreadsheet.
2025-03-25 15:48:31 +01:00
Tobias Hunger
731289c018 live-preview: Get rid of the "dummy" workaround
... used to get changed notifications for aliased properties.

This was fixed last week, so it is no longer necessary.
2025-03-25 15:47:41 +01:00
Tobias Hunger
e0b6e4f27d live-preview: Fix the gradient becoming inactive till a slider is touched 2025-03-21 18:11:45 +01:00