mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 02:16:56 -06:00
fix(components): a boolean property's default is its bound layers' visibility on the main (#993)
component.addProperty {type: "boolean", default: false, layer} hid the
bound layer in new instances but left it showing in the main component,
so the main didn't show its own default.
On the main, a boolean property's value is now the visibility of the
layers bound to it:
- addProperty, bindProperty {field: "visible"} and editProperty {default}
show or hide the main's bound layers to match the default (every
variant of a set for editProperty). Without a default, addProperty
takes the bound layer's current visibility instead of always `true`.
- Showing or hiding a bound layer on the main sets the default, and the
property's other bound layers (in every variant) follow. Edits inside
instances stay overrides.
- Existing instances keep their stored values; documents open as saved
(no normalisation on load).
Fixes #993
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
35da7b7cff
commit
014098b6c9
@@ -713,6 +713,14 @@ most when it can't be reached).
|
||||
moves the chosen variant there, `{name, index}` reorders variant properties (the variants'
|
||||
names follow). `component.properties` on a set reports `conflicts`: variants sharing one
|
||||
combination of values.
|
||||
- **Boolean properties**: on the main component, a boolean property's value is the visibility of
|
||||
the layers bound to it. `component.addProperty {type: "boolean", default, layer}`,
|
||||
`component.bindProperty {field: "visible"}` and `component.editProperty {name, default}` show or
|
||||
hide the main's bound layers to match the default (without `default`, `addProperty` takes the
|
||||
bound layer's visibility). Showing or hiding a bound layer on the main sets the default, and the
|
||||
property's other bound layers (in every variant of a set) follow. New instances start from the
|
||||
default; existing instances keep the values they have. Files open as saved: a main whose bound
|
||||
layer disagrees with the default stays that way until one of them is edited.
|
||||
- `component.pushChanges {id?}` copies the instance's overrides into its main (from a layer of a
|
||||
nested instance too: always into the outer instance's main).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user