Skip to content

Commit 524195e

Browse files
committed
Blockly: explain the multiselect feature
openhab/openhab-webui#2419 Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
1 parent 89206d2 commit 524195e

4 files changed

Lines changed: 64 additions & 40 deletions

File tree

configuration/blockly/rules-blockly-before-using.md

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,52 +87,63 @@ See the following video on ![youtube](../images/blockly/youtube-logo-small.png)
8787

8888
More about the topic of code generation can be viewed at ![youtube](../images/blockly/youtube-logo-small.png) [Blockly as an ECMA-Script code generator](https://youtu.be/EdllUlJ7p6k?t=1739)
8989

90-
### Block context menu
90+
### Panning and Zooming
9191

92-
It should also be mentioned that each of the blocks do have a context sensitive menu which appears upon a right click on the block itself.
92+
You can move around Blockly's workspace by clicking and dragging on the empty space, or by using two fingers on a touch screen or a trackpad.
9393

94-
![blockly-context.png](../images/blockly/blockly-contextmenu.png)
94+
Zooming can be done using either of these methods:
9595

96-
#### **Cross-Rule-Copy/Paste**
96+
- By pinching or stretching on a touch screen or a trackpad.
97+
- By holding <kbd>Ctrl</kbd> while dragging or moving with two fingers on the touch screen or trackpad.
98+
- With the on-screen controls:
99+
100+
![workspace-zoom-controls](../images/blockly/blockly-zoom.png)
97101

98-
Sometimes you may want to copy some blocks from one rule to another.
99-
This is what _Cross-Rule-Copy/Paste_ is for.
100-
Just mark the block(s) you want to copy, click on _Cross-Rule-Copy_ and then in the destination rule open the context menu and click on _Cross-Rule-Paste_.
102+
### Context Menu
101103

102-
![cross-rule-copy](../images/blockly/blockly-cross-rule-copy.png)
104+
A context menu is available when right-clicking on a block.
103105

104-
Note that you cannot select several blocks at once but only one block to copy.
106+
![Blockly Context Menu](../images/blockly/blockly-contextmenu.png)
105107

106-
::: tip Copy multiple blocks
108+
Right-clicking on an empty area in the workspace will pop up a slightly different context menu.
109+
In particular, `Clean up Blocks` will automatically move and arrange your blocks neatly.
107110

108-
A way to copy multiple blocks at once is to copy a parent block, e.g. a loop block, that contains all the blocks you want to copy together.
109-
If you want to copy a number of connected blocks at once that do not have a parent block, there is nice trick to do that anyway: drag a function block into the workspace of the source rule, add the blocks to be copied into that function block, copy that function block and then paste it in the destination rule.
110-
Then in the destination rule just remove the function block that helped you to copy the inner blocks.
111+
### Selecting Blocks
111112

112-
:::
113+
Click on a block to select it.
113114

114-
Copy and Paste in Action:
115+
You can select multiple blocks by holding the <kbd>Shift</kbd> key while clicking on other blocks.
116+
Alternatively, hold down the <kbd>Shift</kbd> key, click on an empty area and start dragging to select the blocks within the selection rectangle.
115117

116-
![copy-and-paste-in-action](../images/blockly/blockly-cross-rule-copy-and-paste.gif)
118+
Child blocks are automatically selected when their parent is selected.
119+
120+
Once selected, the blocks can be copied, duplicated, deleted, or moved around.
121+
122+
### Copying & Pasting
123+
124+
Copy-pasting can be used as a quick way to duplicate a set of blocks within the same script.
125+
You can also copy a set of blocks into your clipboard, and paste them into another script.
126+
127+
### Other Operations
117128

118129
- **Duplicate**: Clones the block
119130
- **Add comment**: Adds a comment to the block
120131
- **Inline Inputs** / External inputs: Switches between horizontal or vertical alignment of inputs
121132

122-
Inline:
123-
![inline-inputs](../images/blockly/blockly-inputs-inline.png)
133+
Inline:
134+
![inline-inputs](../images/blockly/blockly-inputs-inline.png)
124135

125-
External:
126-
![external-inputs](../images/blockly/blockly-inputs-external.png)
136+
External:
137+
![external-inputs](../images/blockly/blockly-inputs-external.png)
127138

128139
- **Collapse (expand) block**: Shrinks the block to get a better overview
129140

130-
Normal block view:
131-
![expanded-block](../images/blockly/blockly-expanded.png)
141+
Normal block view:
142+
![expanded-block](../images/blockly/blockly-expanded.png)
132143

133-
Collapsed view:
144+
Collapsed view:
134145

135-
![collapsed-block](../images/blockly/blockly-collapsed.png)
146+
![collapsed-block](../images/blockly/blockly-collapsed.png)
136147

137148
- **Disable (enable) block**: Disables the block, so no code is generated and its functionality switched off
138149
- **Delete**: delete the blocks (this can be reverted via Command/Ctrl-Z)
@@ -145,14 +156,6 @@ After pressing _Enter_ all found blocks that contain the search term are marked
145156

146157
![blockly-search](../images/blockly/blockly-search.png)
147158

148-
### Zoom the workspace
149-
150-
The following controls allow the workspace to be zoomed:
151-
152-
![workspace-zoom-controls](../images/blockly/blockly-zoom.png)
153-
154-
Pinching on a tablet or a touch bar also allows convenient zooming of the workspace.
155-
156159
## Use Frontail for viewing log files
157160

158161
During development the log-block is lot very often which writes information into the log files.
20.1 KB
Loading
-4.79 MB
Binary file not shown.

mainui/settings/blockly-editor.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,44 @@ The following is a short overview of the most important keyboard shortcuts.
1414

1515
Mac users should use <kbd>Cmd</kbd> instead of <kbd>Ctrl</kbd> for most shortcuts.
1616

17+
Panning & Zooming:
18+
19+
- <kbd>Click</kbd> + <kbd>Drag</kbd>, <kbd>Scroll Wheel</kbd> (mouse), or <kbd>Two Fingers</kbd> (trackpad) to pan around.
20+
- <kbd>Ctrl</kbd> + <kbd>Scroll Wheel</kbd> or <kbd>Ctrl</kbd> + <kbd>Two Fingers</kbd> to zoom in and out.
21+
1722
Selection:
1823

1924
- Click a block to select it.
25+
- <kbd>Shift</kbd> + <kbd>Click</kbd> or <kbd>Shift</kbd> + <kbd>Drag</kbd>: Select multiple blocks.
26+
- <kbd>Ctrl</kbd> + <kbd>A</kbd>: Select all blocks.
27+
- Clicking on an empty area deselects everything.
2028

21-
Deleting a block:
29+
Deleting Blocks:
2230

23-
- Once selected, it can be deleted with the <kbd>Delete</kbd> key.
24-
- Alternatively the block can be dragged into the toolbox area to delete it.
31+
- <kbd>Delete</kbd>: Delete the selected blocks.
32+
- Alternatively, the blocks can be deleted by dragging them into the toolbox area.
2533

2634
Copy & Paste:
2735

28-
- <kbd>Ctrl+C</kbd>: Copy the selected block.
29-
- <kbd>Ctrl+X</kbd>: Cut selected block.
30-
- <kbd>Ctrl+V</kbd>: Paste what has been copied.
36+
- <kbd>Ctrl</kbd> + <kbd>C</kbd>: Copy the selected blocks.
37+
- <kbd>Ctrl</kbd> + <kbd>X</kbd>: Cut the selected blocks.
38+
- <kbd>Ctrl</kbd> + <kbd>V</kbd>: Paste what has been copied.
39+
- Copied blocks can be pasted into another Blockly script in a different window/tab.
40+
41+
Search:
42+
43+
- <kbd>Ctrl</kbd>+<kbd>F</kbd>: Search in blocks.
3144

3245
Redo & Undo:
3346

34-
- <kbd>Ctrl+Z</kbd>: Undo the last change.
35-
- <kbd>Ctrl+Y</kbd> (<kbd>Shift+Cmd+Z</kbd> on Mac): Redo the last change.
47+
- <kbd>Ctrl</kbd> + <kbd>Z</kbd>: Undo the last change.
48+
- <kbd>Ctrl</kbd> + <kbd>Y</kbd> (<kbd>Shift</kbd> + <kbd>Cmd</kbd> + <kbd>Z</kbd> on Mac): Redo the last change.
49+
50+
Commenting:
51+
52+
- Right click on the block and select <kbd>Add Comment</kbd>
53+
54+
Formatting:
55+
56+
- Right click on an empty area and select `Clean up Blocks`
3657
<!-- END MAINUI SIDEBAR DOC - DO NOT REMOVE -->

0 commit comments

Comments
 (0)