Skip to content

Commit f63f86f

Browse files
Merge branch 'work/improve-apis-and-docs'
2 parents bee6451 + 994eda2 commit f63f86f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1405
-173
lines changed

.github/ISSUE_TEMPLATE/translation-js-draw-de.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ body:
305305
label: 'deleteSelection'
306306
description: 'Translate `Delete selection`.'
307307
placeholder: 'Delete selection'
308+
value: 'Auswahl löschen'
308309
render: 'shell'
309310
validations:
310311
required: false
@@ -314,6 +315,7 @@ body:
314315
label: 'duplicateSelection'
315316
description: 'Translate `Duplicate selection`.'
316317
placeholder: 'Duplicate selection'
318+
value: 'Auswahl duplizieren'
317319
render: 'shell'
318320
validations:
319321
required: false

.github/ISSUE_TEMPLATE/translation-js-draw-es.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ body:
302302
label: 'deleteSelection'
303303
description: 'Translate `Delete selection`.'
304304
placeholder: 'Delete selection'
305+
value: 'Borra la selección'
305306
render: 'shell'
306307
validations:
307308
required: false
@@ -311,6 +312,7 @@ body:
311312
label: 'duplicateSelection'
312313
description: 'Translate `Duplicate selection`.'
313314
placeholder: 'Duplicate selection'
315+
value: 'Duplica la selección'
314316
render: 'shell'
315317
validations:
316318
required: false

docs/demo/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ <h1 class="main-header">
1818
<a href="https://github.com/personalizedrefrigerator/js-draw"><code>js-draw</code></a>
1919
<div style="flex-grow: 1"></div>
2020

21-
<a href="https://personalizedrefrigerator.github.io/js-draw/typedoc/modules/js-draw.html"
22-
>API</a
23-
>
21+
<a href="../typedoc/">API</a>
2422
</h1>
2523
<div id="actions-container"></div>
2624
</div>
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
```ts,runnable
22
import {
3-
Editor, EditorImage, Stroke, pathToRenderable.
4-
Path, Color4,
3+
Editor, EditorImage, Stroke, Path, Color4,
54
} from 'js-draw';
65
76
const editor = new Editor(document.body);
87
9-
const stroke = new Stroke([
10-
pathToRenderable(Path.fromString('m0,0 l100,100 l0,-10 z'), { fill: Color4.red }),
11-
]);
12-
editor.dispatch(EditorImage.addElement(stroke));
8+
const stroke = Stroke.fromFilled(
9+
Path.fromString('m0,0 l100,100 l0,-10 z'),
10+
Color4.red,
11+
);
12+
editor.dispatch(EditorImage.addComponent(stroke));
1313
```

docs/doc-pages/inline-examples/adding-an-image-and-data-urls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const scaledByFactorOf100 = Mat33.scaling2D(100);
1414
const transform = rotated45Degrees.rightMul(scaledByFactorOf100);
1515
1616
const imageComponent = await ImageComponent.fromImage(myHtmlImage, transform);
17-
await editor.dispatch(editor.image.addElement(imageComponent));
17+
await editor.dispatch(editor.image.addComponent(imageComponent));
1818
1919
//
2020
// Make a new image from the editor itself (with editor.toDataURL)

docs/doc-pages/inline-examples/image-add-and-lookup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function addStroke(path: Path, style: RenderingStyle) {
1515
1616
// Create a command that adds the stroke to the image
1717
// (but don't apply it yet).
18-
const command = editor.image.addElement(stroke);
18+
const command = editor.image.addComponent(stroke);
1919
// Actually apply the command.
2020
editor.dispatch(command);
2121
}
@@ -50,7 +50,7 @@ addBoxAt(Vec2.of(20, 0), Color4.orange);
5050
addBoxAt(Vec2.of(20, 20), Color4.blue);
5151
5252
// Get the components in a small rectangle near (0, 0)
53-
const components = editor.image.getElementsIntersectingRegion(
53+
const components = editor.image.getComponentsIntersecting(
5454
new Rect2(0, 0, 5, 5), // a 5x5 square with top left (0, 0)
5555
);
5656

docs/doc-pages/pages/guides.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ category: Guides
44
children:
55
- ./guides/setup.md
66
- ./guides/writing-a-theme.md
7-
- ./guides/customizing-tools.md
7+
- ./guides/components.md
88
- ./guides/updating-the-view.md
9+
- ./guides/customizing-tools.md
910
- ./guides/positioning-an-element-above-the-editor.md
1011
---
1112

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Components
3+
category: Guides
4+
children:
5+
- ./components/strokes.md
6+
- ./components/custom-components.md
7+
---
8+
9+
# Image components
10+
11+
The guides in this section show:
12+
13+
- How to change the content of an open editor (erase/duplicate/add strokes).
14+
- How to create custom components.

0 commit comments

Comments
 (0)