js-draw 1.26.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/Editor.css +1 -1
  2. package/dist/bundle.js +42 -37
  3. package/dist/bundledStyles.js +1 -1
  4. package/dist/cjs/Editor.d.ts +0 -2
  5. package/dist/cjs/components/AbstractComponent.d.ts +15 -0
  6. package/dist/cjs/components/AbstractComponent.js +16 -0
  7. package/dist/cjs/components/Stroke.d.ts +1 -0
  8. package/dist/cjs/components/Stroke.js +7 -0
  9. package/dist/cjs/toolbar/IconProvider.d.ts +2 -1
  10. package/dist/cjs/toolbar/IconProvider.js +18 -8
  11. package/dist/cjs/toolbar/localization.d.ts +2 -0
  12. package/dist/cjs/toolbar/localization.js +2 -0
  13. package/dist/cjs/toolbar/widgets/SelectionToolWidget.d.ts +7 -0
  14. package/dist/cjs/toolbar/widgets/SelectionToolWidget.js +109 -28
  15. package/dist/cjs/toolbar/widgets/components/makeButtonGrid.d.ts +17 -0
  16. package/dist/cjs/toolbar/widgets/components/makeButtonGrid.js +40 -0
  17. package/dist/cjs/tools/SelectionTool/Selection.d.ts +2 -3
  18. package/dist/cjs/tools/SelectionTool/Selection.js +19 -40
  19. package/dist/cjs/tools/SelectionTool/SelectionBuilders/LassoSelectionBuilder.d.ts +17 -0
  20. package/dist/cjs/tools/SelectionTool/SelectionBuilders/LassoSelectionBuilder.js +67 -0
  21. package/dist/cjs/tools/SelectionTool/SelectionBuilders/RectSelectionBuilder.d.ts +13 -0
  22. package/dist/cjs/tools/SelectionTool/SelectionBuilders/RectSelectionBuilder.js +33 -0
  23. package/dist/cjs/tools/SelectionTool/SelectionBuilders/SelectionBuilder.d.ts +15 -0
  24. package/dist/cjs/tools/SelectionTool/SelectionBuilders/SelectionBuilder.js +39 -0
  25. package/dist/cjs/tools/SelectionTool/SelectionTool.d.ts +10 -2
  26. package/dist/cjs/tools/SelectionTool/SelectionTool.js +68 -55
  27. package/dist/cjs/tools/SelectionTool/types.d.ts +4 -0
  28. package/dist/cjs/tools/SelectionTool/types.js +6 -1
  29. package/dist/cjs/tools/lib.d.ts +1 -1
  30. package/dist/cjs/tools/lib.js +2 -1
  31. package/dist/cjs/util/ReactiveValue.js +2 -6
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/mjs/Editor.d.ts +0 -2
  34. package/dist/mjs/components/AbstractComponent.d.ts +15 -0
  35. package/dist/mjs/components/AbstractComponent.mjs +16 -0
  36. package/dist/mjs/components/Stroke.d.ts +1 -0
  37. package/dist/mjs/components/Stroke.mjs +7 -0
  38. package/dist/mjs/toolbar/IconProvider.d.ts +2 -1
  39. package/dist/mjs/toolbar/IconProvider.mjs +18 -8
  40. package/dist/mjs/toolbar/localization.d.ts +2 -0
  41. package/dist/mjs/toolbar/localization.mjs +2 -0
  42. package/dist/mjs/toolbar/widgets/SelectionToolWidget.d.ts +7 -0
  43. package/dist/mjs/toolbar/widgets/SelectionToolWidget.mjs +109 -28
  44. package/dist/mjs/toolbar/widgets/components/makeButtonGrid.d.ts +17 -0
  45. package/dist/mjs/toolbar/widgets/components/makeButtonGrid.mjs +35 -0
  46. package/dist/mjs/tools/SelectionTool/Selection.d.ts +2 -3
  47. package/dist/mjs/tools/SelectionTool/Selection.mjs +19 -40
  48. package/dist/mjs/tools/SelectionTool/SelectionBuilders/LassoSelectionBuilder.d.ts +17 -0
  49. package/dist/mjs/tools/SelectionTool/SelectionBuilders/LassoSelectionBuilder.mjs +61 -0
  50. package/dist/mjs/tools/SelectionTool/SelectionBuilders/RectSelectionBuilder.d.ts +13 -0
  51. package/dist/mjs/tools/SelectionTool/SelectionBuilders/RectSelectionBuilder.mjs +27 -0
  52. package/dist/mjs/tools/SelectionTool/SelectionBuilders/SelectionBuilder.d.ts +15 -0
  53. package/dist/mjs/tools/SelectionTool/SelectionBuilders/SelectionBuilder.mjs +36 -0
  54. package/dist/mjs/tools/SelectionTool/SelectionTool.d.ts +10 -2
  55. package/dist/mjs/tools/SelectionTool/SelectionTool.mjs +68 -55
  56. package/dist/mjs/tools/SelectionTool/types.d.ts +4 -0
  57. package/dist/mjs/tools/SelectionTool/types.mjs +5 -0
  58. package/dist/mjs/tools/lib.d.ts +1 -1
  59. package/dist/mjs/tools/lib.mjs +1 -1
  60. package/dist/mjs/util/ReactiveValue.mjs +2 -6
  61. package/dist/mjs/version.mjs +1 -1
  62. package/package.json +4 -4
  63. package/src/toolbar/EdgeToolbar.scss +6 -1
  64. package/src/toolbar/widgets/components/components.scss +1 -0
  65. package/src/toolbar/widgets/components/makeButtonGrid.scss +25 -0
  66. package/src/tools/SelectionTool/SelectionTool.scss +1 -0
  67. package/src/tools/util/createMenuOverlay.scss +3 -2
@@ -1,4 +1,4 @@
1
- import { Mat33, Vec2 } from '@js-draw/math';
1
+ import { Mat33, Vec2, Color4 } from '@js-draw/math';
2
2
  import { EditorEventType } from '../../types.mjs';
3
3
  import Viewport from '../../Viewport.mjs';
4
4
  import BaseTool from '../BaseTool.mjs';
@@ -9,7 +9,12 @@ import TextComponent from '../../components/TextComponent.mjs';
9
9
  import { duplicateSelectionShortcut, translateLeftSelectionShortcutId, translateRightSelectionShortcutId, selectAllKeyboardShortcut, sendToBackSelectionShortcut, snapToGridKeyboardShortcutId, translateDownSelectionShortcutId, translateUpSelectionShortcutId, rotateClockwiseSelectionShortcutId, rotateCounterClockwiseSelectionShortcutId, stretchXSelectionShortcutId, shrinkXSelectionShortcutId, shrinkYSelectionShortcutId, stretchYSelectionShortcutId, stretchXYSelectionShortcutId, shrinkXYSelectionShortcutId, } from '../keybindings.mjs';
10
10
  import ToPointerAutoscroller from './ToPointerAutoscroller.mjs';
11
11
  import showSelectionContextMenu from './util/showSelectionContextMenu.mjs';
12
+ import { MutableReactiveValue } from '../../util/ReactiveValue.mjs';
13
+ import { SelectionMode } from './types.mjs';
14
+ import LassoSelectionBuilder from './SelectionBuilders/LassoSelectionBuilder.mjs';
15
+ import RectSelectionBuilder from './SelectionBuilders/RectSelectionBuilder.mjs';
12
16
  export const cssPrefix = 'selection-tool-';
17
+ export { SelectionMode };
13
18
  // Allows users to select/transform portions of the `EditorImage`.
14
19
  // With respect to `extend`ing, `SelectionTool` is not stable.
15
20
  export default class SelectionTool extends BaseTool {
@@ -19,7 +24,7 @@ export default class SelectionTool extends BaseTool {
19
24
  // True if clearing and recreating the selectionBox has been deferred. This is used to prevent the selection
20
25
  // from vanishing on pointerdown events that are intended to form other gestures (e.g. long press) that would
21
26
  // ultimately restore the selection.
22
- this.rebuildSelectionScheduled = false;
27
+ this.removeSelectionScheduled = false;
23
28
  this.startPoint = null; // canvas position
24
29
  this.expandingSelectionBox = false;
25
30
  this.shiftKeyPressed = false;
@@ -33,6 +38,13 @@ export default class SelectionTool extends BaseTool {
33
38
  // Whether the last keypress corresponded to an action that didn't transform the
34
39
  // selection (and thus does not need to be finalized on onKeyUp).
35
40
  this.hasUnfinalizedTransformFromKeyPress = false;
41
+ this.modeValue = MutableReactiveValue.fromInitialValue(SelectionMode.Rectangle);
42
+ this.modeValue.onUpdate(() => {
43
+ this.editor.notifier.dispatch(EditorEventType.ToolUpdated, {
44
+ kind: EditorEventType.ToolUpdated,
45
+ tool: this,
46
+ });
47
+ });
36
48
  this.autoscroller = new ToPointerAutoscroller(editor.viewport, (scrollBy) => {
37
49
  editor.dispatch(Viewport.transformBy(Mat33.translation(scrollBy)), false);
38
50
  // Update the selection box/content to match the new viewport.
@@ -61,26 +73,19 @@ export default class SelectionTool extends BaseTool {
61
73
  this.editor.handleKeyEventsFrom(this.handleOverlay);
62
74
  this.editor.handlePointerEventsFrom(this.handleOverlay);
63
75
  }
64
- makeSelectionBox(selectionStartPos) {
76
+ getSelectionColor() {
77
+ const colorString = getComputedStyle(this.handleOverlay).getPropertyValue('--selection-background-color');
78
+ return Color4.fromString(colorString).withAlpha(0.5);
79
+ }
80
+ makeSelectionBox(selectedObjects) {
65
81
  this.prevSelectionBox = this.selectionBox;
66
- this.selectionBox = new Selection(selectionStartPos, this.editor, this.showContextMenu);
82
+ this.selectionBox = new Selection(selectedObjects, this.editor, this.showContextMenu);
67
83
  if (!this.expandingSelectionBox) {
68
84
  // Remove any previous selection rects
69
85
  this.prevSelectionBox?.cancelSelection();
70
86
  }
71
87
  this.selectionBox.addTo(this.handleOverlay);
72
88
  }
73
- snapSelectionToGrid() {
74
- if (!this.selectionBox)
75
- throw new Error('No selection to snap!');
76
- // Snap the top left corner of what we have selected.
77
- const topLeftOfBBox = this.selectionBox.computeTightBoundingBox().topLeft;
78
- const snappedTopLeft = this.editor.viewport.snapToGrid(topLeftOfBBox);
79
- const snapDelta = snappedTopLeft.minus(topLeftOfBBox);
80
- const oldTransform = this.selectionBox.getTransform();
81
- this.selectionBox.setTransform(oldTransform.rightMul(Mat33.translation(snapDelta)));
82
- this.selectionBox.finalizeTransform();
83
- }
84
89
  onContextMenu(event) {
85
90
  const canShowSelectionMenu = this.selectionBox
86
91
  ?.getScreenRegion()
@@ -99,7 +104,7 @@ export default class SelectionTool extends BaseTool {
99
104
  let transforming = false;
100
105
  if (this.selectionBox) {
101
106
  if (snapToGrid) {
102
- this.snapSelectionToGrid();
107
+ this.selectionBox.snapSelectedObjectsToGrid();
103
108
  }
104
109
  const dragStartResult = this.selectionBox.onDragStart(current);
105
110
  if (dragStartResult) {
@@ -111,7 +116,13 @@ export default class SelectionTool extends BaseTool {
111
116
  if (!transforming) {
112
117
  // Shift key: Combine the new and old selection boxes at the end of the gesture.
113
118
  this.expandingSelectionBox = this.shiftKeyPressed;
114
- this.rebuildSelectionScheduled = true;
119
+ this.removeSelectionScheduled = !this.expandingSelectionBox;
120
+ if (this.modeValue.get() === SelectionMode.Lasso) {
121
+ this.selectionBuilder = new LassoSelectionBuilder(current.canvasPos, this.editor.viewport);
122
+ }
123
+ else {
124
+ this.selectionBuilder = new RectSelectionBuilder(current.canvasPos);
125
+ }
115
126
  }
116
127
  else {
117
128
  // Only autoscroll if we're transforming an existing selection
@@ -126,13 +137,12 @@ export default class SelectionTool extends BaseTool {
126
137
  }
127
138
  onMainPointerUpdated(currentPointer) {
128
139
  this.lastPointer = currentPointer;
129
- if (this.rebuildSelectionScheduled) {
130
- this.rebuildSelectionScheduled = false;
131
- this.makeSelectionBox(this.startPoint ?? currentPointer.canvasPos);
132
- this.selectionBox?.setHandlesVisible(false);
140
+ if (this.removeSelectionScheduled) {
141
+ this.removeSelectionScheduled = false;
142
+ this.handleOverlay.replaceChildren();
143
+ this.prevSelectionBox = this.selectionBox;
144
+ this.selectionBox = null;
133
145
  }
134
- if (!this.selectionBox)
135
- return;
136
146
  this.autoscroller.onPointerMove(currentPointer.screenPos);
137
147
  if (!this.expandingSelectionBox && this.shiftKeyPressed && this.startPoint) {
138
148
  const screenPos = this.editor.viewport.canvasToScreen(this.startPoint);
@@ -142,47 +152,46 @@ export default class SelectionTool extends BaseTool {
142
152
  currentPointer = currentPointer.snappedToGrid(this.editor.viewport);
143
153
  }
144
154
  if (this.selectionBoxHandlingEvt) {
145
- this.selectionBox.onDragUpdate(currentPointer);
155
+ this.selectionBox?.onDragUpdate(currentPointer);
146
156
  }
147
157
  else {
148
- this.selectionBox.setToPoint(currentPointer.canvasPos);
158
+ this.selectionBuilder?.onPointerMove(currentPointer.canvasPos);
159
+ this.editor.clearWetInk();
160
+ this.selectionBuilder?.render(this.editor.display.getWetInkRenderer(), this.getSelectionColor());
149
161
  }
150
162
  }
151
163
  onPointerUp(event) {
152
164
  this.onMainPointerUpdated(event.current);
153
165
  this.autoscroller.stop();
154
- if (!this.selectionBox)
155
- return;
156
- this.selectionBox.setHandlesVisible(true);
157
- // Were we expanding the previous selection?
158
- if (this.expandingSelectionBox && this.prevSelectionBox) {
159
- // If so, finish expanding.
160
- this.expandingSelectionBox = false;
161
- this.selectionBox.resolveToObjects();
162
- this.setSelection([
163
- ...this.selectionBox.getSelectedObjects(),
164
- ...this.prevSelectionBox.getSelectedObjects(),
165
- ]);
166
+ if (this.selectionBoxHandlingEvt) {
167
+ this.selectionBox?.onDragEnd();
166
168
  }
167
- else {
168
- if (!this.selectionBoxHandlingEvt) {
169
- // Expand/shrink the selection rectangle, if applicable
170
- this.selectionBox.resolveToObjects();
171
- this.onSelectionUpdated();
169
+ else if (this.selectionBuilder) {
170
+ const newSelection = this.selectionBuilder.resolve(this.editor.image, this.editor.viewport);
171
+ this.selectionBuilder = null;
172
+ this.editor.clearWetInk();
173
+ if (this.expandingSelectionBox && this.selectionBox) {
174
+ this.setSelection([...this.selectionBox.getSelectedObjects(), ...newSelection]);
172
175
  }
173
176
  else {
174
- this.selectionBox.onDragEnd();
177
+ this.setSelection(newSelection);
175
178
  }
176
- this.selectionBoxHandlingEvt = false;
177
- this.lastPointer = null;
178
179
  }
180
+ this.expandingSelectionBox = false;
181
+ this.removeSelectionScheduled = false;
182
+ this.selectionBoxHandlingEvt = false;
183
+ this.lastPointer = null;
179
184
  }
180
185
  onGestureCancel() {
186
+ if (this.selectionBuilder) {
187
+ this.selectionBuilder = null;
188
+ this.editor.clearWetInk();
189
+ }
181
190
  this.autoscroller.stop();
182
191
  if (this.selectionBoxHandlingEvt) {
183
192
  this.selectionBox?.onDragCancel();
184
193
  }
185
- else if (!this.rebuildSelectionScheduled) {
194
+ else if (!this.removeSelectionScheduled) {
186
195
  // Revert to the previous selection, if any.
187
196
  this.selectionBox?.cancelSelection();
188
197
  this.selectionBox = this.prevSelectionBox;
@@ -190,7 +199,7 @@ export default class SelectionTool extends BaseTool {
190
199
  this.selectionBox?.recomputeRegion();
191
200
  this.prevSelectionBox = null;
192
201
  }
193
- this.rebuildSelectionScheduled = false;
202
+ this.removeSelectionScheduled = false;
194
203
  this.expandingSelectionBox = false;
195
204
  this.lastPointer = null;
196
205
  this.selectionBoxHandlingEvt = false;
@@ -458,6 +467,10 @@ export default class SelectionTool extends BaseTool {
458
467
  getSelection() {
459
468
  return this.selectionBox;
460
469
  }
470
+ /** @returns true if the selection is currently being created by the user. */
471
+ isSelecting() {
472
+ return !!this.selectionBuilder;
473
+ }
461
474
  getSelectedObjects() {
462
475
  return this.selectionBox?.getSelectedObjects() ?? [];
463
476
  }
@@ -483,20 +496,20 @@ export default class SelectionTool extends BaseTool {
483
496
  bbox = object.getBBox();
484
497
  }
485
498
  }
486
- if (!bbox) {
487
- return;
488
- }
489
- this.clearSelection();
490
- if (!this.selectionBox) {
491
- this.makeSelectionBox(bbox.topLeft);
499
+ this.clearSelectionNoUpdateEvent();
500
+ if (bbox) {
501
+ this.makeSelectionBox(objects);
492
502
  }
493
- this.selectionBox.setSelectedObjects(objects, bbox);
494
503
  this.onSelectionUpdated();
495
504
  }
496
- clearSelection() {
505
+ // Equivalent to .clearSelection, but does not dispatch an update event
506
+ clearSelectionNoUpdateEvent() {
497
507
  this.handleOverlay.replaceChildren();
498
508
  this.prevSelectionBox = this.selectionBox;
499
509
  this.selectionBox = null;
510
+ }
511
+ clearSelection() {
512
+ this.clearSelectionNoUpdateEvent();
500
513
  this.onSelectionUpdated();
501
514
  }
502
515
  }
@@ -1,5 +1,9 @@
1
1
  import type { Rect2, Point2 } from '@js-draw/math';
2
2
  import Pointer from '../../Pointer';
3
+ export declare enum SelectionMode {
4
+ Lasso = "lasso",
5
+ Rectangle = "rect"
6
+ }
3
7
  export declare enum ResizeMode {
4
8
  Both = 0,
5
9
  HorizontalOnly = 1,
@@ -1,3 +1,8 @@
1
+ export var SelectionMode;
2
+ (function (SelectionMode) {
3
+ SelectionMode["Lasso"] = "lasso";
4
+ SelectionMode["Rectangle"] = "rect";
5
+ })(SelectionMode || (SelectionMode = {}));
1
6
  export var ResizeMode;
2
7
  (function (ResizeMode) {
3
8
  ResizeMode[ResizeMode["Both"] = 0] = "Both";
@@ -7,7 +7,7 @@ export { default as ToolSwitcherShortcut } from './ToolSwitcherShortcut';
7
7
  export { default as PanZoomTool, PanZoomMode } from './PanZoom';
8
8
  export { default as PenTool, PenStyle } from './Pen';
9
9
  export { default as TextTool } from './TextTool';
10
- export { default as SelectionTool } from './SelectionTool/SelectionTool';
10
+ export { default as SelectionTool, SelectionMode } from './SelectionTool/SelectionTool';
11
11
  export { default as SelectAllShortcutHandler } from './SelectionTool/SelectAllShortcutHandler';
12
12
  export { default as EraserTool, EraserMode } from './Eraser';
13
13
  export { default as PasteHandler } from './PasteHandler';
@@ -7,7 +7,7 @@ export { default as ToolSwitcherShortcut } from './ToolSwitcherShortcut.mjs';
7
7
  export { default as PanZoomTool, PanZoomMode } from './PanZoom.mjs';
8
8
  export { default as PenTool } from './Pen.mjs';
9
9
  export { default as TextTool } from './TextTool.mjs';
10
- export { default as SelectionTool } from './SelectionTool/SelectionTool.mjs';
10
+ export { default as SelectionTool, SelectionMode } from './SelectionTool/SelectionTool.mjs';
11
11
  export { default as SelectAllShortcutHandler } from './SelectionTool/SelectAllShortcutHandler.mjs';
12
12
  export { default as EraserTool, EraserMode } from './Eraser.mjs';
13
13
  export { default as PasteHandler } from './PasteHandler.mjs';
@@ -69,9 +69,7 @@ export class ReactiveValue {
69
69
  */
70
70
  static fromCallback(callback, sourceValues) {
71
71
  const result = new ReactiveValueImpl(callback());
72
- const resultRef = window.WeakRef
73
- ? new window.WeakRef(result)
74
- : { deref: () => result };
72
+ const resultRef = typeof WeakRef !== 'undefined' ? new WeakRef(result) : { deref: () => result };
75
73
  for (const value of sourceValues) {
76
74
  const listener = value.onUpdate(() => {
77
75
  // Use resultRef to allow `result` to be garbage collected
@@ -114,9 +112,7 @@ export class ReactiveValue {
114
112
  export class MutableReactiveValue extends ReactiveValue {
115
113
  static fromProperty(sourceValue, propertyName) {
116
114
  const child = ReactiveValue.fromInitialValue(sourceValue.get()[propertyName]);
117
- const childRef = window.WeakRef
118
- ? new window.WeakRef(child)
119
- : { deref: () => child };
115
+ const childRef = typeof WeakRef !== 'undefined' ? new WeakRef(child) : { deref: () => child };
120
116
  // When the source is updated...
121
117
  const sourceListener = sourceValue.onUpdate((newValue) => {
122
118
  const childValue = childRef.deref();
@@ -4,5 +4,5 @@
4
4
  * @internal
5
5
  */
6
6
  export default {
7
- number: '1.26.0',
7
+ number: '1.27.1',
8
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-draw",
3
- "version": "1.26.0",
3
+ "version": "1.27.1",
4
4
  "description": "Draw pictures using a pen, touchscreen, or mouse! JS-draw is a drawing library for JavaScript and TypeScript. ",
5
5
  "types": "./dist/mjs/lib.d.ts",
6
6
  "main": "./dist/cjs/lib.js",
@@ -64,11 +64,11 @@
64
64
  "postpack": "ts-node tools/copyREADME.ts revert"
65
65
  },
66
66
  "dependencies": {
67
- "@js-draw/math": "^1.26.0",
67
+ "@js-draw/math": "^1.27.1",
68
68
  "@melloware/coloris": "0.22.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@js-draw/build-tool": "^1.26.0",
71
+ "@js-draw/build-tool": "^1.27.1",
72
72
  "@types/jest": "29.5.5",
73
73
  "@types/jsdom": "21.1.3"
74
74
  },
@@ -86,5 +86,5 @@
86
86
  "freehand",
87
87
  "svg"
88
88
  ],
89
- "gitHead": "6529cad584ca93a992f2576a43f25af48da3d707"
89
+ "gitHead": "e11574b7b329e7867358c400457a3d99b1d2c469"
90
90
  }
@@ -340,7 +340,7 @@
340
340
  transition: 0.2s ease box-shadow;
341
341
 
342
342
  &:not(:disabled):hover {
343
- box-shadow: 0 1px 2px var(--shadow-color);
343
+ box-shadow: 0 0px 2px var(--shadow-color);
344
344
  }
345
345
 
346
346
  &:disabled {
@@ -360,6 +360,11 @@
360
360
  @include labelVisibleOnHover.label-visible-on-hover('label > .button-label-text');
361
361
  }
362
362
 
363
+ .toolbar-button-grid button {
364
+ --button-label-hover-offset-y: 0;
365
+ @include labelVisibleOnHover.label-visible-on-hover('label');
366
+ }
367
+
363
368
  .toolbar-help-overlay-button {
364
369
  align-items: last baseline;
365
370
  }
@@ -4,3 +4,4 @@
4
4
  @use './makeFileInput.scss';
5
5
  @use './makeGridSelector.scss';
6
6
  @use './makeSnappedList.scss';
7
+ @use './makeButtonGrid.scss';
@@ -0,0 +1,25 @@
1
+ .toolbar-button-grid {
2
+ display: grid;
3
+ grid-template-columns: repeat(var(--column-count), 1fr);
4
+ justify-items: center;
5
+ --button-size: 30px;
6
+
7
+ > .button {
8
+ font-size: 1em;
9
+ width: min-content;
10
+
11
+ > .icon {
12
+ max-width: var(--button-size);
13
+ max-height: var(--button-size);
14
+
15
+ // Ensures that all icons have the same base size
16
+ width: 48px;
17
+ height: 48px;
18
+ }
19
+
20
+ > label {
21
+ display: block;
22
+ font-weight: normal;
23
+ }
24
+ }
25
+ }
@@ -156,6 +156,7 @@
156
156
 
157
157
  &.-empty {
158
158
  opacity: 0;
159
+ display: none;
159
160
  }
160
161
 
161
162
  &.-hide-handles .selection-tool-handle {
@@ -31,7 +31,7 @@
31
31
 
32
32
  overflow: clip;
33
33
  border-radius: 6px;
34
- box-shadow: 0px 1px 2px var(--shadow-color);
34
+ box-shadow: 0px 0px 2px var(--shadow-color);
35
35
  background-color: var(--background-color-1);
36
36
  }
37
37
 
@@ -66,9 +66,10 @@
66
66
  width: 1em;
67
67
  height: 1em;
68
68
  flex-shrink: 0;
69
+ align-self: center;
69
70
 
70
71
  // RTL support:
71
72
  margin-inline-start: 0em;
72
- margin-inline-end: 0.25em;
73
+ margin-inline-end: 0.32em;
73
74
  }
74
75
  }