react-cheminfo 0.132.0 → 0.133.0
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.
- package/lib/drawing/captionEditor/CaptionEditor.d.ts +3 -3
- package/lib/drawing/captionEditor/CaptionEditor.d.ts.map +1 -1
- package/lib/drawing/captionEditor/CaptionEditor.js +8 -4
- package/lib/drawing/captionEditor/CaptionEditor.js.map +1 -1
- package/lib/drawing/captionEditor/CaptionToolbar.d.ts +4 -2
- package/lib/drawing/captionEditor/CaptionToolbar.d.ts.map +1 -1
- package/lib/drawing/captionEditor/CaptionToolbar.js +6 -4
- package/lib/drawing/captionEditor/CaptionToolbar.js.map +1 -1
- package/lib/drawing/captionEditor/index.d.ts +2 -0
- package/lib/drawing/captionEditor/index.d.ts.map +1 -1
- package/lib/drawing/captionEditor/index.js +1 -0
- package/lib/drawing/captionEditor/index.js.map +1 -1
- package/lib/drawing/captionEditor/toolbarInView.d.ts +40 -0
- package/lib/drawing/captionEditor/toolbarInView.d.ts.map +1 -0
- package/lib/drawing/captionEditor/toolbarInView.js +53 -0
- package/lib/drawing/captionEditor/toolbarInView.js.map +1 -0
- package/lib/drawing/core/camera.d.ts +2 -0
- package/lib/drawing/core/camera.d.ts.map +1 -1
- package/lib/drawing/core/camera.js +2 -0
- package/lib/drawing/core/camera.js.map +1 -1
- package/lib/drawing/core/index.d.ts +1 -1
- package/lib/drawing/core/index.d.ts.map +1 -1
- package/lib/drawing/core/index.js +1 -1
- package/lib/drawing/core/index.js.map +1 -1
- package/lib/drawing/render/index.d.ts +1 -1
- package/lib/drawing/render/index.d.ts.map +1 -1
- package/lib/drawing/render/index.js +1 -1
- package/lib/drawing/render/index.js.map +1 -1
- package/lib/drawing/render/pageGrid.d.ts +16 -0
- package/lib/drawing/render/pageGrid.d.ts.map +1 -1
- package/lib/drawing/render/pageGrid.js +28 -10
- package/lib/drawing/render/pageGrid.js.map +1 -1
- package/lib/drawing/ui/PageField.d.ts +29 -0
- package/lib/drawing/ui/PageField.d.ts.map +1 -0
- package/lib/drawing/ui/PageField.js +38 -0
- package/lib/drawing/ui/PageField.js.map +1 -0
- package/lib/drawing/ui/PageGrid.d.ts +20 -0
- package/lib/drawing/ui/PageGrid.d.ts.map +1 -0
- package/lib/drawing/ui/PageGrid.js +26 -0
- package/lib/drawing/ui/PageGrid.js.map +1 -0
- package/lib/drawing/ui/PageSideInput.d.ts +28 -0
- package/lib/drawing/ui/PageSideInput.d.ts.map +1 -0
- package/lib/drawing/ui/PageSideInput.js +47 -0
- package/lib/drawing/ui/PageSideInput.js.map +1 -0
- package/lib/drawing/ui/PageToolbar.d.ts +16 -0
- package/lib/drawing/ui/PageToolbar.d.ts.map +1 -0
- package/lib/drawing/ui/PageToolbar.js +16 -0
- package/lib/drawing/ui/PageToolbar.js.map +1 -0
- package/lib/drawing/ui/PrintSheets.d.ts +32 -0
- package/lib/drawing/ui/PrintSheets.d.ts.map +1 -0
- package/lib/drawing/ui/PrintSheets.js +17 -0
- package/lib/drawing/ui/PrintSheets.js.map +1 -0
- package/lib/drawing/ui/TextToolIcon.d.ts +19 -0
- package/lib/drawing/ui/TextToolIcon.d.ts.map +1 -0
- package/lib/drawing/ui/TextToolIcon.js +21 -0
- package/lib/drawing/ui/TextToolIcon.js.map +1 -0
- package/lib/drawing/ui/ZoomControl.d.ts +25 -0
- package/lib/drawing/ui/ZoomControl.d.ts.map +1 -0
- package/lib/drawing/ui/ZoomControl.js +27 -0
- package/lib/drawing/ui/ZoomControl.js.map +1 -0
- package/lib/drawing/ui/index.d.ts +10 -0
- package/lib/drawing/ui/index.d.ts.map +1 -1
- package/lib/drawing/ui/index.js +7 -0
- package/lib/drawing/ui/index.js.map +1 -1
- package/lib/guide/ui/EmptyGuide.d.ts +5 -2
- package/lib/guide/ui/EmptyGuide.d.ts.map +1 -1
- package/lib/guide/ui/EmptyGuide.js +8 -3
- package/lib/guide/ui/EmptyGuide.js.map +1 -1
- package/lib/guide/ui/GuideFigures.d.ts +6 -0
- package/lib/guide/ui/GuideFigures.d.ts.map +1 -1
- package/lib/guide/ui/GuideFigures.js +5 -5
- package/lib/guide/ui/GuideFigures.js.map +1 -1
- package/lib/mass/core/index.d.ts +1 -0
- package/lib/mass/core/index.d.ts.map +1 -1
- package/lib/mass/core/index.js +1 -0
- package/lib/mass/core/index.js.map +1 -1
- package/lib/mass/core/massDomain.d.ts.map +1 -1
- package/lib/mass/core/massDomain.js +9 -5
- package/lib/mass/core/massDomain.js.map +1 -1
- package/lib/mass/core/massSpectrum.d.ts +9 -0
- package/lib/mass/core/massSpectrum.d.ts.map +1 -1
- package/lib/mass/core/massSpectrum.js.map +1 -1
- package/lib/mass/core/verticalScale.d.ts +30 -0
- package/lib/mass/core/verticalScale.d.ts.map +1 -0
- package/lib/mass/core/verticalScale.js +40 -0
- package/lib/mass/core/verticalScale.js.map +1 -0
- package/lib/mass/ui/MassChart.d.ts.map +1 -1
- package/lib/mass/ui/MassChart.js +4 -38
- package/lib/mass/ui/MassChart.js.map +1 -1
- package/lib/mass/ui/massChartLayers.d.ts +31 -0
- package/lib/mass/ui/massChartLayers.d.ts.map +1 -0
- package/lib/mass/ui/massChartLayers.js +57 -0
- package/lib/mass/ui/massChartLayers.js.map +1 -0
- package/lib/structure/core/index.d.ts +1 -1
- package/lib/structure/core/index.d.ts.map +1 -1
- package/lib/structure/core/index.js.map +1 -1
- package/lib/structure/core/structurePicture.d.ts +32 -1
- package/lib/structure/core/structurePicture.d.ts.map +1 -1
- package/lib/structure/core/structurePicture.js +29 -2
- package/lib/structure/core/structurePicture.js.map +1 -1
- package/lib/structure/ui/StructureEditor.d.ts +2 -1
- package/lib/structure/ui/StructureEditor.d.ts.map +1 -1
- package/lib/structure/ui/StructureEditor.js +9 -3
- package/lib/structure/ui/StructureEditor.js.map +1 -1
- package/lib/structure/ui/StructureEditorGuide.d.ts +15 -0
- package/lib/structure/ui/StructureEditorGuide.d.ts.map +1 -0
- package/lib/structure/ui/StructureEditorGuide.js +26 -0
- package/lib/structure/ui/StructureEditorGuide.js.map +1 -0
- package/lib/structure/ui/structureEditorProps.d.ts +11 -1
- package/lib/structure/ui/structureEditorProps.d.ts.map +1 -1
- package/lib/structure/ui/useCanvasPress.d.ts +23 -0
- package/lib/structure/ui/useCanvasPress.d.ts.map +1 -0
- package/lib/structure/ui/useCanvasPress.js +53 -0
- package/lib/structure/ui/useCanvasPress.js.map +1 -0
- package/lib/xps/core/detectFormat.d.ts +6 -0
- package/lib/xps/core/detectFormat.d.ts.map +1 -1
- package/lib/xps/core/detectFormat.js +8 -0
- package/lib/xps/core/detectFormat.js.map +1 -1
- package/lib/xps/core/xpsEditorApi.d.ts +16 -0
- package/lib/xps/core/xpsEditorApi.d.ts.map +1 -1
- package/lib/xps/ui/XpsCanvas.d.ts +10 -1
- package/lib/xps/ui/XpsCanvas.d.ts.map +1 -1
- package/lib/xps/ui/XpsCanvas.js +14 -3
- package/lib/xps/ui/XpsCanvas.js.map +1 -1
- package/lib/xps/ui/XpsChart.d.ts.map +1 -1
- package/lib/xps/ui/XpsChart.js +12 -43
- package/lib/xps/ui/XpsChart.js.map +1 -1
- package/lib/xps/ui/XpsEditor.d.ts +8 -0
- package/lib/xps/ui/XpsEditor.d.ts.map +1 -1
- package/lib/xps/ui/XpsEditor.js +2 -2
- package/lib/xps/ui/XpsEditor.js.map +1 -1
- package/lib/xps/ui/XpsShell.d.ts +5 -0
- package/lib/xps/ui/XpsShell.d.ts.map +1 -1
- package/lib/xps/ui/XpsShell.js +18 -4
- package/lib/xps/ui/XpsShell.js.map +1 -1
- package/lib/xps/ui/dropEvents.d.ts +8 -1
- package/lib/xps/ui/dropEvents.d.ts.map +1 -1
- package/lib/xps/ui/dropEvents.js +15 -1
- package/lib/xps/ui/dropEvents.js.map +1 -1
- package/lib/xps/ui/useSpectrumDrop.d.ts +6 -0
- package/lib/xps/ui/useSpectrumDrop.d.ts.map +1 -1
- package/lib/xps/ui/useSpectrumDrop.js +1 -1
- package/lib/xps/ui/useSpectrumDrop.js.map +1 -1
- package/lib/xps/ui/useXpsEditorHandle.d.ts +4 -1
- package/lib/xps/ui/useXpsEditorHandle.d.ts.map +1 -1
- package/lib/xps/ui/useXpsEditorHandle.js +6 -2
- package/lib/xps/ui/useXpsEditorHandle.js.map +1 -1
- package/lib/xps/ui/useXpsReadout.d.ts +43 -0
- package/lib/xps/ui/useXpsReadout.d.ts.map +1 -0
- package/lib/xps/ui/useXpsReadout.js +59 -0
- package/lib/xps/ui/useXpsReadout.js.map +1 -0
- package/lib/xps/ui/xpsChartProps.d.ts +9 -0
- package/lib/xps/ui/xpsChartProps.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/drawing/captionEditor/CaptionEditor.tsx +8 -3
- package/src/drawing/captionEditor/CaptionToolbar.tsx +18 -2
- package/src/drawing/captionEditor/index.ts +2 -0
- package/src/drawing/captionEditor/toolbarInView.ts +73 -0
- package/src/drawing/core/camera.ts +3 -0
- package/src/drawing/core/index.ts +1 -0
- package/src/drawing/render/index.ts +2 -0
- package/src/drawing/render/pageGrid.ts +29 -11
- package/src/drawing/ui/PageField.tsx +104 -0
- package/src/drawing/ui/PageGrid.tsx +48 -0
- package/src/drawing/ui/PageSideInput.tsx +81 -0
- package/src/drawing/ui/PageToolbar.tsx +45 -0
- package/src/drawing/ui/PrintSheets.tsx +57 -0
- package/src/drawing/ui/TextToolIcon.tsx +48 -0
- package/src/drawing/ui/ZoomControl.tsx +112 -0
- package/src/drawing/ui/index.ts +10 -0
- package/src/guide/ui/EmptyGuide.tsx +20 -13
- package/src/guide/ui/GuideFigures.tsx +15 -4
- package/src/mass/core/index.ts +1 -0
- package/src/mass/core/massDomain.ts +9 -3
- package/src/mass/core/massSpectrum.ts +9 -0
- package/src/mass/core/verticalScale.ts +48 -0
- package/src/mass/ui/MassChart.tsx +12 -43
- package/src/mass/ui/massChartLayers.ts +66 -0
- package/src/structure/core/index.ts +1 -0
- package/src/structure/core/structurePicture.ts +78 -4
- package/src/structure/ui/StructureEditor.tsx +13 -2
- package/src/structure/ui/StructureEditorGuide.tsx +35 -0
- package/src/structure/ui/structureEditorProps.ts +11 -1
- package/src/structure/ui/useCanvasPress.ts +69 -0
- package/src/xps/core/detectFormat.ts +9 -0
- package/src/xps/core/xpsEditorApi.ts +16 -0
- package/src/xps/ui/XpsCanvas.tsx +26 -3
- package/src/xps/ui/XpsChart.tsx +12 -56
- package/src/xps/ui/XpsEditor.tsx +10 -0
- package/src/xps/ui/XpsShell.tsx +37 -7
- package/src/xps/ui/dropEvents.ts +16 -1
- package/src/xps/ui/useSpectrumDrop.ts +7 -1
- package/src/xps/ui/useXpsEditorHandle.ts +12 -2
- package/src/xps/ui/useXpsReadout.ts +104 -0
- package/src/xps/ui/xpsChartProps.ts +9 -0
- package/styles/caption-editor.css +15 -1
- package/styles/chrome.css +130 -9
- package/styles/drawing.css +100 -0
|
@@ -20,3 +20,5 @@ export {
|
|
|
20
20
|
} from './captionSchema.ts';
|
|
21
21
|
export type { CaptionToolbarProps } from './CaptionToolbar.tsx';
|
|
22
22
|
export { CaptionToolbar } from './CaptionToolbar.tsx';
|
|
23
|
+
export type { ToolbarFit } from './toolbarInView.ts';
|
|
24
|
+
export { toolbarFit, useToolbarInView } from './toolbarInView.ts';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeping a caption's toolbar inside the area it is drawn over: the bar is
|
|
3
|
+
* centred over its caption, so a caption near an edge would leave part of the
|
|
4
|
+
* bar — its first buttons, or the tick that keeps the caption — outside a
|
|
5
|
+
* figure that clips what overflows it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { RefObject } from 'react';
|
|
9
|
+
import { useLayoutEffect } from 'react';
|
|
10
|
+
|
|
11
|
+
/** How far the bar keeps from the area's edges, in pixels. */
|
|
12
|
+
const TOOLBAR_INSET = 4;
|
|
13
|
+
|
|
14
|
+
/** A box on screen, as `getBoundingClientRect` gives it. */
|
|
15
|
+
interface ScreenBox {
|
|
16
|
+
left: number;
|
|
17
|
+
right: number;
|
|
18
|
+
top: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Where a caption's toolbar is moved to stay in view. */
|
|
22
|
+
export interface ToolbarFit {
|
|
23
|
+
/** How far it is moved sideways, in pixels: positive to the right. */
|
|
24
|
+
shift: number;
|
|
25
|
+
/** Whether it goes under the caption, the area having no room above. */
|
|
26
|
+
below: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Where a toolbar centred over its caption goes to stay inside an area: moved
|
|
31
|
+
* sideways no more than it overflows, its left edge kept in view first, and
|
|
32
|
+
* under the caption when it would rise above the area.
|
|
33
|
+
* @param bar - The toolbar where it is centred.
|
|
34
|
+
* @param area - The area it must stay in.
|
|
35
|
+
* @returns The move.
|
|
36
|
+
*/
|
|
37
|
+
export function toolbarFit(bar: ScreenBox, area: ScreenBox): ToolbarFit {
|
|
38
|
+
let shift = 0;
|
|
39
|
+
if (bar.right > area.right - TOOLBAR_INSET) {
|
|
40
|
+
shift = area.right - TOOLBAR_INSET - bar.right;
|
|
41
|
+
}
|
|
42
|
+
if (bar.left + shift < area.left + TOOLBAR_INSET) {
|
|
43
|
+
shift = area.left + TOOLBAR_INSET - bar.left;
|
|
44
|
+
}
|
|
45
|
+
return { shift, below: bar.top < area.top + TOOLBAR_INSET };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Keep the toolbar of a caption being typed inside the box the caption is
|
|
50
|
+
* laid over (its offset parent), after every render: moved sideways through
|
|
51
|
+
* `--caption-toolbar-shift`, and under the caption with `data-below`.
|
|
52
|
+
* `react-cheminfo/styles/caption-editor.css` reads both.
|
|
53
|
+
* @param ref - The caption editor's frame (`.caption-editor`), or any element
|
|
54
|
+
* inside it, such as the box the text is typed in.
|
|
55
|
+
*/
|
|
56
|
+
export function useToolbarInView(ref: RefObject<HTMLElement | null>): void {
|
|
57
|
+
useLayoutEffect(() => {
|
|
58
|
+
const frame = ref.current?.closest<HTMLElement>('.caption-editor');
|
|
59
|
+
const toolbar = frame?.querySelector<HTMLElement>('.caption-toolbar');
|
|
60
|
+
const area = frame?.offsetParent;
|
|
61
|
+
if (!toolbar || !area) return;
|
|
62
|
+
toolbar.style.removeProperty('--caption-toolbar-shift');
|
|
63
|
+
delete toolbar.dataset.below;
|
|
64
|
+
const { shift, below } = toolbarFit(
|
|
65
|
+
toolbar.getBoundingClientRect(),
|
|
66
|
+
area.getBoundingClientRect(),
|
|
67
|
+
);
|
|
68
|
+
if (shift !== 0) {
|
|
69
|
+
toolbar.style.setProperty('--caption-toolbar-shift', `${shift}px`);
|
|
70
|
+
}
|
|
71
|
+
if (below) toolbar.dataset.below = '';
|
|
72
|
+
});
|
|
73
|
+
}
|
|
@@ -27,6 +27,9 @@ export const ZOOM_PRESETS: readonly number[] = [
|
|
|
27
27
|
0.25, 0.5, 0.75, 1, 1.5, 2, 3, 4, 8, 16,
|
|
28
28
|
];
|
|
29
29
|
|
|
30
|
+
/** How much one press of `+` zooms in, and of `-` zooms out. */
|
|
31
|
+
export const ZOOM_STEP = 1.25;
|
|
32
|
+
|
|
30
33
|
/** How close the view starts on an empty page: a bond is 36 px long. */
|
|
31
34
|
export const START_CAMERA: Camera = { x: 0, y: 0, zoom: 2.5 };
|
|
32
35
|
|
|
@@ -73,10 +73,12 @@ export {
|
|
|
73
73
|
} from './motion.ts';
|
|
74
74
|
export {
|
|
75
75
|
MAX_SHEETS,
|
|
76
|
+
boxSheets,
|
|
76
77
|
enclosingBox,
|
|
77
78
|
figureBox,
|
|
78
79
|
paddedBox,
|
|
79
80
|
pageSheets,
|
|
81
|
+
pagesLine,
|
|
80
82
|
sheetLines,
|
|
81
83
|
} from './pageGrid.ts';
|
|
82
84
|
export type { ImagePrimitive } from './pictures.ts';
|
|
@@ -8,7 +8,7 @@ import { placedPage } from '../core/pages.ts';
|
|
|
8
8
|
import type { Box, DrawPage, FigureSize } from '../core/types.ts';
|
|
9
9
|
|
|
10
10
|
import { primitivesBounds } from './bounds.ts';
|
|
11
|
-
import type { Scene
|
|
11
|
+
import type { Scene } from './primitives.ts';
|
|
12
12
|
|
|
13
13
|
/** The most sheets a drawing goes on: past them, the rest does not print. */
|
|
14
14
|
export const MAX_SHEETS = 200;
|
|
@@ -25,6 +25,20 @@ interface Tile {
|
|
|
25
25
|
row: number;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* What the page lines mean for printing, said under the page setup.
|
|
30
|
+
* @param sheets - How many sheets hold something; null when the lines are
|
|
31
|
+
* hidden.
|
|
32
|
+
* @returns The line.
|
|
33
|
+
*/
|
|
34
|
+
export function pagesLine(sheets: number | null): string {
|
|
35
|
+
if (sheets === null) return 'The whole drawing prints on one page.';
|
|
36
|
+
if (sheets >= MAX_SHEETS) return `Only the first ${MAX_SHEETS} pages print.`;
|
|
37
|
+
const printed =
|
|
38
|
+
sheets === 1 ? 'One page prints' : `${sheets} pages print, one sheet each`;
|
|
39
|
+
return `Drag objects across the lines. ${printed}.`;
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
/**
|
|
29
43
|
* The box a scene is written in: its drawing, and the padding around it.
|
|
30
44
|
* @param scene - The scene.
|
|
@@ -48,7 +62,12 @@ export function paddedBox(scene: Scene, padding = 4) {
|
|
|
48
62
|
* @returns The sheets, in points.
|
|
49
63
|
*/
|
|
50
64
|
export function pageSheets(scene: Scene, page: DrawPage): Box[] {
|
|
51
|
-
|
|
65
|
+
const boxes: Box[] = [];
|
|
66
|
+
for (const item of scene.items) {
|
|
67
|
+
const box = primitivesBounds(item.primitives);
|
|
68
|
+
if (box) boxes.push(box);
|
|
69
|
+
}
|
|
70
|
+
return boxSheets(boxes, placedPage(page, paddedBox(scene)));
|
|
52
71
|
}
|
|
53
72
|
|
|
54
73
|
/**
|
|
@@ -71,21 +90,20 @@ export function figureBox(scene: Scene, figure?: FigureSize): Box {
|
|
|
71
90
|
}
|
|
72
91
|
|
|
73
92
|
/**
|
|
74
|
-
* The sheets of a grid that hold something,
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @param
|
|
93
|
+
* The sheets of a paper's grid that hold something, for an editor that knows
|
|
94
|
+
* its drawing as boxes rather than as a scene: the sheets any box reaches into,
|
|
95
|
+
* in reading order, and the first of the grid when there is none.
|
|
96
|
+
* @param boxes - What is drawn, one box per item, in points.
|
|
97
|
+
* @param page - The paper, with its place: `placedPage` over the drawing.
|
|
78
98
|
* @returns The sheets, in points, at most {@link MAX_SHEETS}.
|
|
79
99
|
*/
|
|
80
|
-
function
|
|
81
|
-
|
|
100
|
+
export function boxSheets(
|
|
101
|
+
boxes: readonly Box[],
|
|
82
102
|
page: Required<DrawPage>,
|
|
83
103
|
): Box[] {
|
|
84
104
|
const { x, y, width, height } = page;
|
|
85
105
|
const tiles = new Map<string, Tile>();
|
|
86
|
-
for (const
|
|
87
|
-
const box = primitivesBounds(item.primitives);
|
|
88
|
-
if (!box) continue;
|
|
106
|
+
for (const box of boxes) {
|
|
89
107
|
const columns = span(box.x, box.width, x, width);
|
|
90
108
|
const rows = span(box.y, box.height, y, height);
|
|
91
109
|
for (let row = rows.first; row <= rows.last; row++) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FormGroup, HTMLSelect, SegmentedControl } from '@blueprintjs/core';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import type { Orientation } from '../core/pages.ts';
|
|
5
|
+
import {
|
|
6
|
+
PAGE_SIZES,
|
|
7
|
+
orientationOf,
|
|
8
|
+
pickedPage,
|
|
9
|
+
samePaper,
|
|
10
|
+
turnedTo,
|
|
11
|
+
} from '../core/pages.ts';
|
|
12
|
+
import type { DrawPage } from '../core/types.ts';
|
|
13
|
+
|
|
14
|
+
import { PageSideInput } from './PageSideInput.tsx';
|
|
15
|
+
|
|
16
|
+
const CUSTOM = 'custom';
|
|
17
|
+
|
|
18
|
+
/** How a new size of page was asked for. */
|
|
19
|
+
export type PageChange = 'picked' | 'typed';
|
|
20
|
+
|
|
21
|
+
/** What {@link PageField} is given. */
|
|
22
|
+
export interface PageFieldProps {
|
|
23
|
+
/** The paper or the slide the drawing is laid out on. */
|
|
24
|
+
page: DrawPage;
|
|
25
|
+
/**
|
|
26
|
+
* Called with the page asked for, its place left to the editor: `picked`
|
|
27
|
+
* from the menu or turned, after which the whole page is usually framed, or
|
|
28
|
+
* `typed` side by side.
|
|
29
|
+
*/
|
|
30
|
+
onChange: (page: DrawPage, how: PageChange) => void;
|
|
31
|
+
/**
|
|
32
|
+
* What is said under the fields, such as `pagesLine`'s count of sheets.
|
|
33
|
+
* @default undefined — nothing
|
|
34
|
+
*/
|
|
35
|
+
helperText?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The page setup of an editor, the same in every one of the family: the paper
|
|
40
|
+
* or the slide the drawing is laid out on, portrait or landscape, and its two
|
|
41
|
+
* sides in centimetres. `react-cheminfo/styles/drawing.css` lays it out.
|
|
42
|
+
* @param props - See {@link PageFieldProps}.
|
|
43
|
+
* @returns A row of a form.
|
|
44
|
+
*/
|
|
45
|
+
export function PageField(props: PageFieldProps): ReactElement {
|
|
46
|
+
const { page, onChange, helperText } = props;
|
|
47
|
+
const matched = PAGE_SIZES.find((paper) => samePaper(paper.size, page));
|
|
48
|
+
return (
|
|
49
|
+
<FormGroup label="Page" helperText={helperText}>
|
|
50
|
+
<HTMLSelect
|
|
51
|
+
iconName="caret-down"
|
|
52
|
+
fill
|
|
53
|
+
value={matched?.id ?? CUSTOM}
|
|
54
|
+
aria-label="Page size"
|
|
55
|
+
options={[
|
|
56
|
+
...PAGE_SIZES.map((paper) => ({
|
|
57
|
+
value: paper.id,
|
|
58
|
+
label: paper.name,
|
|
59
|
+
})),
|
|
60
|
+
...(matched ? [] : [{ value: CUSTOM, label: 'Another size' }]),
|
|
61
|
+
]}
|
|
62
|
+
onChange={(event) => {
|
|
63
|
+
const { value } = event.currentTarget;
|
|
64
|
+
const chosen = PAGE_SIZES.find((paper) => paper.id === value);
|
|
65
|
+
if (chosen) onChange(pickedPage(chosen.size, page), 'picked');
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
{page.width === page.height ? null : (
|
|
69
|
+
<SegmentedControl
|
|
70
|
+
className="page-field__orientation"
|
|
71
|
+
aria-label="Page orientation"
|
|
72
|
+
size="small"
|
|
73
|
+
fill
|
|
74
|
+
value={orientationOf(page)}
|
|
75
|
+
options={[
|
|
76
|
+
{ label: 'Portrait', value: 'portrait' },
|
|
77
|
+
{ label: 'Landscape', value: 'landscape' },
|
|
78
|
+
]}
|
|
79
|
+
onValueChange={(orientation) => {
|
|
80
|
+
onChange(turnedTo(page, orientation as Orientation), 'picked');
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
)}
|
|
84
|
+
<div className="page-field__size">
|
|
85
|
+
<PageSideInput
|
|
86
|
+
label="Page width"
|
|
87
|
+
value={page.width}
|
|
88
|
+
onChange={(width) => {
|
|
89
|
+
onChange({ ...page, width }, 'typed');
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
<span aria-hidden="true">×</span>
|
|
93
|
+
<PageSideInput
|
|
94
|
+
label="Page height"
|
|
95
|
+
value={page.height}
|
|
96
|
+
onChange={(height) => {
|
|
97
|
+
onChange({ ...page, height }, 'typed');
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
<span className="page-field__unit">cm</span>
|
|
101
|
+
</div>
|
|
102
|
+
</FormGroup>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Box } from '../core/types.ts';
|
|
4
|
+
import { sheetLines } from '../render/pageGrid.ts';
|
|
5
|
+
|
|
6
|
+
/** The size of a sheet's number on screen, in pixels. */
|
|
7
|
+
const NUMBER_SIZE = 11;
|
|
8
|
+
|
|
9
|
+
/** How far a sheet's number stands from its corner, in pixels. */
|
|
10
|
+
const NUMBER_INSET = 6;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The lines of a grid of sheets across an unlimited canvas, and the number each
|
|
14
|
+
* sheet that holds something prints under. They never print themselves, and
|
|
15
|
+
* the pointer goes through them to what is drawn.
|
|
16
|
+
* `react-cheminfo/styles/drawing.css` draws them.
|
|
17
|
+
* @param props - The sheets and the view.
|
|
18
|
+
* @param props.sheets - The sheets that hold something, in reading order, as
|
|
19
|
+
* `pageSheets` lists them; empty when the page lines are hidden.
|
|
20
|
+
* @param props.visible - The box the view shows, in points.
|
|
21
|
+
* @param props.pixel - A screen pixel, in points.
|
|
22
|
+
* @returns The grid, or nothing.
|
|
23
|
+
*/
|
|
24
|
+
export function PageGrid(props: {
|
|
25
|
+
sheets: readonly Box[];
|
|
26
|
+
visible: Box;
|
|
27
|
+
pixel: number;
|
|
28
|
+
}): ReactElement | null {
|
|
29
|
+
const { sheets, visible, pixel } = props;
|
|
30
|
+
const [first] = sheets;
|
|
31
|
+
if (!first) return null;
|
|
32
|
+
return (
|
|
33
|
+
<g data-testid="draw-page-grid" className="no-print" aria-hidden="true">
|
|
34
|
+
<path className="draw-sheet" d={sheetLines(first, visible)} />
|
|
35
|
+
{sheets.map((sheet, index) => (
|
|
36
|
+
<text
|
|
37
|
+
key={`${sheet.x} ${sheet.y}`}
|
|
38
|
+
className="draw-sheet__number"
|
|
39
|
+
x={sheet.x + NUMBER_INSET * pixel}
|
|
40
|
+
y={sheet.y + (NUMBER_INSET + NUMBER_SIZE) * pixel}
|
|
41
|
+
fontSize={NUMBER_SIZE * pixel}
|
|
42
|
+
>
|
|
43
|
+
{`Page ${index + 1}`}
|
|
44
|
+
</text>
|
|
45
|
+
))}
|
|
46
|
+
</g>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
import { NumberInput } from '../../number/ui/NumberInput.tsx';
|
|
4
|
+
import { PAGE_LIMITS, POINTS_PER_CM } from '../core/pages.ts';
|
|
5
|
+
|
|
6
|
+
const MIN_SIDE = PAGE_LIMITS.min / POINTS_PER_CM;
|
|
7
|
+
const MAX_SIDE = PAGE_LIMITS.max / POINTS_PER_CM;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A side of a sheet of paper, in centimetres.
|
|
11
|
+
* @param props - The side.
|
|
12
|
+
* @param props.label - Its name.
|
|
13
|
+
* @param props.value - Its length in points.
|
|
14
|
+
* @param props.onChange - Called with the length in points.
|
|
15
|
+
* @returns The field.
|
|
16
|
+
*/
|
|
17
|
+
export function PageSideInput(props: {
|
|
18
|
+
label: string;
|
|
19
|
+
value: number;
|
|
20
|
+
onChange: (side: number) => void;
|
|
21
|
+
}): ReactElement {
|
|
22
|
+
const { label, value, onChange } = props;
|
|
23
|
+
return (
|
|
24
|
+
<NumberInput
|
|
25
|
+
size="small"
|
|
26
|
+
buttons={false}
|
|
27
|
+
ariaLabel={`${label}, in centimetres`}
|
|
28
|
+
value={round(value / POINTS_PER_CM)}
|
|
29
|
+
min={MIN_SIDE}
|
|
30
|
+
max={MAX_SIDE}
|
|
31
|
+
step={0.1}
|
|
32
|
+
onChange={(centimetres: number) => {
|
|
33
|
+
if (fits(centimetres)) onChange(centimetres * POINTS_PER_CM);
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A side of a figure in centimetres; emptied, it fits the drawing.
|
|
41
|
+
* @param props - The side.
|
|
42
|
+
* @param props.label - Its name.
|
|
43
|
+
* @param props.value - Its length in points, when it is set.
|
|
44
|
+
* @param props.onChange - Called with the length in points, or undefined.
|
|
45
|
+
* @returns The field.
|
|
46
|
+
*/
|
|
47
|
+
export function FigureSideInput(props: {
|
|
48
|
+
label: string;
|
|
49
|
+
value: number | undefined;
|
|
50
|
+
onChange: (side: number | undefined) => void;
|
|
51
|
+
}): ReactElement {
|
|
52
|
+
const { label, value, onChange } = props;
|
|
53
|
+
return (
|
|
54
|
+
<NumberInput
|
|
55
|
+
size="small"
|
|
56
|
+
buttons={false}
|
|
57
|
+
allowEmpty
|
|
58
|
+
ariaLabel={`${label}, in centimetres; empty fits the drawing`}
|
|
59
|
+
placeholder="fits"
|
|
60
|
+
value={value === undefined ? undefined : round(value / POINTS_PER_CM)}
|
|
61
|
+
min={MIN_SIDE}
|
|
62
|
+
max={MAX_SIDE}
|
|
63
|
+
step={0.1}
|
|
64
|
+
onChange={(centimetres: number | undefined) => {
|
|
65
|
+
if (centimetres === undefined) onChange(undefined);
|
|
66
|
+
else if (fits(centimetres)) onChange(centimetres * POINTS_PER_CM);
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// A side typed halfway (the 2 of 21) waits for the next digit rather than being
|
|
73
|
+
// raised to the smallest side under the caret.
|
|
74
|
+
function fits(centimetres: number): boolean {
|
|
75
|
+
return centimetres >= MIN_SIDE && centimetres <= MAX_SIDE;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// To the hundredth, so a side typed to the millimetre reads back as typed.
|
|
79
|
+
function round(value: number): number {
|
|
80
|
+
return Math.round(value * 100) / 100;
|
|
81
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { Toolbar, TooltipHelpContent } from 'react-science/ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The toolbar of an editor's page setup panel: the page grid shown or hidden,
|
|
6
|
+
* and the whole of the pages brought into view.
|
|
7
|
+
* @param props - Whether the lines are shown, and what the buttons do.
|
|
8
|
+
* @param props.shown - Whether the page lines are on the canvas.
|
|
9
|
+
* @param props.onToggle - Show the lines, or hide them.
|
|
10
|
+
* @param props.onFrame - Bring every page that holds something into view.
|
|
11
|
+
* @returns The toolbar.
|
|
12
|
+
*/
|
|
13
|
+
export function PageToolbar(props: {
|
|
14
|
+
shown: boolean;
|
|
15
|
+
onToggle: () => void;
|
|
16
|
+
onFrame: () => void;
|
|
17
|
+
}): ReactElement {
|
|
18
|
+
const { shown, onToggle, onFrame } = props;
|
|
19
|
+
return (
|
|
20
|
+
<div className="panel-toolbar">
|
|
21
|
+
<Toolbar aria-label="Page setup">
|
|
22
|
+
<Toolbar.Item
|
|
23
|
+
icon="grid"
|
|
24
|
+
active={shown}
|
|
25
|
+
tooltip={
|
|
26
|
+
<TooltipHelpContent
|
|
27
|
+
title="Page grid"
|
|
28
|
+
description="Shown, the lines mark the pages and printing follows them. Hidden, the whole drawing prints on one page."
|
|
29
|
+
/>
|
|
30
|
+
}
|
|
31
|
+
aria-label="Page grid"
|
|
32
|
+
onClick={onToggle}
|
|
33
|
+
/>
|
|
34
|
+
{shown ? (
|
|
35
|
+
<Toolbar.Item
|
|
36
|
+
icon="zoom-to-fit"
|
|
37
|
+
tooltip="Show the whole page"
|
|
38
|
+
aria-label="Show the whole page"
|
|
39
|
+
onClick={onFrame}
|
|
40
|
+
/>
|
|
41
|
+
) : null}
|
|
42
|
+
</Toolbar>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Box, DrawPage } from '../core/types.ts';
|
|
4
|
+
|
|
5
|
+
/** What {@link PrintSheets} is given. */
|
|
6
|
+
export interface PrintSheetsProps {
|
|
7
|
+
/** The paper the drawing is laid out on. */
|
|
8
|
+
page: DrawPage;
|
|
9
|
+
/**
|
|
10
|
+
* What goes on paper: the sheets of the page grid that hold something, or
|
|
11
|
+
* the one box of the whole figure when the grid is hidden.
|
|
12
|
+
*/
|
|
13
|
+
boxes: readonly Box[];
|
|
14
|
+
/** Whether the boxes are sheets of the paper, each filling one. */
|
|
15
|
+
paged: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The figure, drawn in points, for one box: the same drawing for each, the
|
|
18
|
+
* box being what the sheet shows of it.
|
|
19
|
+
*/
|
|
20
|
+
figure: (box: Box) => ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The drawing as it goes on paper, in place of the editor: the figure and
|
|
25
|
+
* nothing else, sized in points, so it prints at the size it was laid out at.
|
|
26
|
+
* With the page grid showing, one sheet of the paper goes to each sheet of the
|
|
27
|
+
* grid that holds something, edge to edge; with the grid hidden, the whole
|
|
28
|
+
* figure goes on one sheet of it, shrunk only when it would not fit. An editor
|
|
29
|
+
* mounts it while `usePrinting` says the page is printed;
|
|
30
|
+
* `react-cheminfo/styles/drawing.css` hides it on screen.
|
|
31
|
+
* @param props - See {@link PrintSheetsProps}.
|
|
32
|
+
* @returns The sheets.
|
|
33
|
+
*/
|
|
34
|
+
export function PrintSheets(props: PrintSheetsProps): ReactElement {
|
|
35
|
+
const { page, boxes, paged, figure } = props;
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={paged ? 'draw-print draw-print--sheets' : 'draw-print'}
|
|
39
|
+
data-testid="print-figure"
|
|
40
|
+
>
|
|
41
|
+
<style>
|
|
42
|
+
{`@page { size: ${page.width}pt ${page.height}pt;${paged ? ' margin: 0;' : ''} }`}
|
|
43
|
+
</style>
|
|
44
|
+
{boxes.map((box) => (
|
|
45
|
+
<svg
|
|
46
|
+
key={`${box.x} ${box.y}`}
|
|
47
|
+
className="draw-print__figure"
|
|
48
|
+
width={`${box.width}pt`}
|
|
49
|
+
height={`${box.height}pt`}
|
|
50
|
+
viewBox={`${box.x} ${box.y} ${box.width} ${box.height}`}
|
|
51
|
+
>
|
|
52
|
+
{figure(box)}
|
|
53
|
+
</svg>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The letter the text tool is drawn with, on a 16-unit square: a serif bold T,
|
|
5
|
+
* for an icon set that draws its own `<svg>` around each glyph.
|
|
6
|
+
* @returns The glyph.
|
|
7
|
+
*/
|
|
8
|
+
export function TextToolGlyph(): ReactElement {
|
|
9
|
+
return (
|
|
10
|
+
<text
|
|
11
|
+
x="8"
|
|
12
|
+
y="12.5"
|
|
13
|
+
textAnchor="middle"
|
|
14
|
+
fontSize="12"
|
|
15
|
+
fontWeight="700"
|
|
16
|
+
fontFamily="Georgia, serif"
|
|
17
|
+
fill="currentColor"
|
|
18
|
+
stroke="none"
|
|
19
|
+
>
|
|
20
|
+
T
|
|
21
|
+
</text>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The icon of the text tool, the same in every editor of the family, in the
|
|
27
|
+
* colour of the text around it.
|
|
28
|
+
* @param props - Its size.
|
|
29
|
+
* @param props.size - Its width and height, in pixels.
|
|
30
|
+
* @returns The icon.
|
|
31
|
+
*/
|
|
32
|
+
export function TextToolIcon(props: {
|
|
33
|
+
/** @default 16 */
|
|
34
|
+
size?: number;
|
|
35
|
+
}): ReactElement {
|
|
36
|
+
const { size = 16 } = props;
|
|
37
|
+
return (
|
|
38
|
+
<svg
|
|
39
|
+
className="tool-icon"
|
|
40
|
+
width={size}
|
|
41
|
+
height={size}
|
|
42
|
+
viewBox="0 0 16 16"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
>
|
|
45
|
+
<TextToolGlyph />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button,
|
|
3
|
+
Menu,
|
|
4
|
+
MenuItem,
|
|
5
|
+
PopoverNext,
|
|
6
|
+
Tooltip,
|
|
7
|
+
} from '@blueprintjs/core';
|
|
8
|
+
import type { ReactElement } from 'react';
|
|
9
|
+
import { TooltipHelpContent } from 'react-science/ui';
|
|
10
|
+
|
|
11
|
+
import { formatPercent } from '../../format/core/numbers.ts';
|
|
12
|
+
import { ZOOM_PRESETS, ZOOM_RANGE, zoomShare } from '../core/camera.ts';
|
|
13
|
+
|
|
14
|
+
import { MeasuredSlider } from './MeasuredSlider.tsx';
|
|
15
|
+
|
|
16
|
+
/** What {@link ZoomControl} is given. */
|
|
17
|
+
export interface ZoomControlProps {
|
|
18
|
+
/** How close the view is: the camera's screen pixels per point. */
|
|
19
|
+
zoom: number;
|
|
20
|
+
/** Called with the share of the printed size asked for: 1 at 100 %. */
|
|
21
|
+
onZoomShare: (share: number) => void;
|
|
22
|
+
/** Called to bring the whole drawing back into view. */
|
|
23
|
+
onFit: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* What fitting brings into view, said in the fit button's tooltip.
|
|
26
|
+
* @default 'Brings the whole drawing back into view.'
|
|
27
|
+
*/
|
|
28
|
+
fitDescription?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The zoom at the right of an editor's status bar, the same in every editor of
|
|
33
|
+
* the family: a slider from 25 % to 1600 % of the printed size, running on the
|
|
34
|
+
* logarithm so each step is the same factor; the value, which opens a menu of
|
|
35
|
+
* the usual zooms; and zoom to fit, on `f`.
|
|
36
|
+
* @param props - See {@link ZoomControlProps}.
|
|
37
|
+
* @returns The control.
|
|
38
|
+
*/
|
|
39
|
+
export function ZoomControl(props: ZoomControlProps): ReactElement {
|
|
40
|
+
const {
|
|
41
|
+
zoom,
|
|
42
|
+
onZoomShare,
|
|
43
|
+
onFit,
|
|
44
|
+
fitDescription = 'Brings the whole drawing back into view.',
|
|
45
|
+
} = props;
|
|
46
|
+
const share = zoomShare(zoom);
|
|
47
|
+
return (
|
|
48
|
+
<span className="zoom-control">
|
|
49
|
+
<MeasuredSlider
|
|
50
|
+
min={Math.log2(ZOOM_RANGE.min)}
|
|
51
|
+
max={Math.log2(ZOOM_RANGE.max)}
|
|
52
|
+
initialValue={Math.log2(ZOOM_RANGE.min)}
|
|
53
|
+
stepSize={0.01}
|
|
54
|
+
labelRenderer={false}
|
|
55
|
+
value={Math.log2(share)}
|
|
56
|
+
onChange={(value) => {
|
|
57
|
+
onZoomShare(2 ** value);
|
|
58
|
+
}}
|
|
59
|
+
handleHtmlProps={{ 'aria-label': 'Zoom' }}
|
|
60
|
+
/>
|
|
61
|
+
<PopoverNext
|
|
62
|
+
placement="top-end"
|
|
63
|
+
content={
|
|
64
|
+
<Menu aria-label="Zoom">
|
|
65
|
+
{ZOOM_PRESETS.map((preset) => (
|
|
66
|
+
<MenuItem
|
|
67
|
+
key={preset}
|
|
68
|
+
text={formatPercent(preset, 0)}
|
|
69
|
+
active={Math.abs(preset - share) < 0.005}
|
|
70
|
+
onClick={() => {
|
|
71
|
+
onZoomShare(preset);
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
))}
|
|
75
|
+
</Menu>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<Button
|
|
79
|
+
className="zoom-control__level"
|
|
80
|
+
variant="minimal"
|
|
81
|
+
size="small"
|
|
82
|
+
text={formatPercent(share, 0)}
|
|
83
|
+
endIcon="caret-up"
|
|
84
|
+
aria-label="Zoom level"
|
|
85
|
+
/>
|
|
86
|
+
</PopoverNext>
|
|
87
|
+
<Tooltip
|
|
88
|
+
placement="top"
|
|
89
|
+
hoverOpenDelay={400}
|
|
90
|
+
content={
|
|
91
|
+
<TooltipHelpContent
|
|
92
|
+
title="Zoom to fit"
|
|
93
|
+
description={fitDescription}
|
|
94
|
+
shortcuts={['f']}
|
|
95
|
+
subTitles={[
|
|
96
|
+
{ title: 'Zoom in and out', shortcuts: ['Wheel', '+', '-'] },
|
|
97
|
+
{ title: 'Move the view', shortcuts: ['Right-drag'] },
|
|
98
|
+
]}
|
|
99
|
+
/>
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
<Button
|
|
103
|
+
variant="minimal"
|
|
104
|
+
size="small"
|
|
105
|
+
icon="zoom-to-fit"
|
|
106
|
+
aria-label="Fit the drawing in view"
|
|
107
|
+
onClick={onFit}
|
|
108
|
+
/>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
</span>
|
|
111
|
+
);
|
|
112
|
+
}
|