-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of graphical layer management for canvas layouts #1187
Conversation
…te component between layouts and items). Signed-off-by: Gautier Taravella <[email protected]>
Job #235: Bundle Size — 10.66MB (~+0.01%).Changed metrics (3/8)
|
Thanks Gautier! I played with it a little while I had the dev server running, though initially I was confused about how to leverage these layers at runtime. Eventually I realized you meant it as a design-time-only feature, correct? There would be some missed potential if that were the case. So after some tinkering since the layers apparently honor the YAMLconfig:
layoutType: fixed
fixedType: canvas
label: Canvas Layers
activeIdx: 2
sidebar: true
defineVars: {}
blocks: []
masonry: null
grid: []
canvas:
- component: oh-canvas-layer
config:
editVisible: false
visible: =!vars.layer || vars.layer === 1
slots:
default:
- component: oh-canvas-item
config:
x: 211
y: 93
h: 115
w: 141
slots:
default:
- component: oh-toggle-card
config: {}
- component: oh-canvas-item
config:
x: 448
y: 156
h: 124
w: 150
slots:
default:
- component: oh-toggle-card
config: {}
- component: oh-canvas-layer
config:
editVisible: false
visible: =vars.layer === 2
slots:
default:
- component: oh-canvas-item
config:
x: 241
y: 64
h: 150
w: 200
slots:
default:
- component: oh-knob-card
config: {}
- component: oh-canvas-layer
config:
layerName: Buttons
slots:
default:
- component: oh-canvas-item
config:
x: 832
y: 43
h: 69
w: 195
slots:
default:
- component: oh-label-card
config:
label: Layer 1
action: variable
actionVariable: layer
actionVariableValue: 1
- component: oh-canvas-item
config:
x: 832
y: 143
h: 69
w: 195
slots:
default:
- component: oh-label-card
config:
label: Layer 2
action: variable
actionVariable: layer
actionVariableValue: 2
- component: oh-canvas-item
config:
x: 838
y: 252
h: 150
w: 200
slots:
default:
- component: oh-label-card
config:
label: =JSON.stringify(vars.layer) I'll review it soon, but in the meantime, I noticed some weaknesses in the implementation:
But great work overall! |
Code-wise it looks like it is a design time feature but I am using it exactly for the purpose that you found: in combination with a variable and expression set to I think that the I will provide an example in the documentation. Having the
I agree with you that I can simplify the UI when there is only one layer.
I will check what you stated about the hide/show button. |
…on for better performance when switching layers. Most layer menu items are no longer shown if less than 2 layers are present in the canvas. Signed-off-by: Gautier Taravella <[email protected]>
No reason, it's somewhat in the backlog but could possibly be added for all widgets that support it (as an advanced property group), as well as other common properties like |
@ghys , do you thing we could get this merged before the imminent next milestone, so that people experimenting the canvas layout would not have to migrate their layout ? |
Signed-off-by: Yannick Schaus <[email protected]>
Job #251: Bundle Size — 10.75MB (+0.06%).Changed metrics (4/8)
Changed assets by type (2/7)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarag I'd say it looks pretty good now.
I fixed a minor bug which broke the component docs generation script, which I run. It's a manual process for now, so please remember to give it a run when you add/change widget parameter definitions.
Also as openhab/openhab-docs#1657 is still open, perhaps you could describe the layers feature there as well while you're at it?
Thanks!
Thanks, I'll try to think about it for the parameter docs. I'll update the docs for the layers feature soon. |
Addition of layers as an intermediate component between canvas layouts and canvas items.
Allows creation of pages with various set of widgets that can easily be toggled between one another. Layer visibility management in edition improves usability when lots of widgets are visible in one canvas.
This is not backwards compatible with previous canvas, so I think it should be merged before to many people start experimenting with canvases in the milestones.
Existing canvas layouts can be easily ported by adding the following YAML lines in the code editor, between canvas and the first canvas-item:
Preview: