js-draw 0.1.8 → 0.1.11
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/CHANGELOG.md +15 -0
- package/README.md +15 -3
- package/dist/bundle.js +1 -1
- package/dist/src/Editor.d.ts +3 -0
- package/dist/src/Editor.js +45 -16
- package/dist/src/UndoRedoHistory.js +3 -0
- package/dist/src/Viewport.js +2 -0
- package/dist/src/bundle/bundled.d.ts +2 -1
- package/dist/src/bundle/bundled.js +2 -1
- package/dist/src/geometry/LineSegment2.d.ts +1 -0
- package/dist/src/geometry/LineSegment2.js +16 -0
- package/dist/src/geometry/Rect2.d.ts +1 -0
- package/dist/src/geometry/Rect2.js +16 -0
- package/dist/src/localizations/en.d.ts +3 -0
- package/dist/src/localizations/en.js +4 -0
- package/dist/src/localizations/es.d.ts +3 -0
- package/dist/src/localizations/es.js +18 -0
- package/dist/src/localizations/getLocalizationTable.d.ts +3 -0
- package/dist/src/localizations/getLocalizationTable.js +43 -0
- package/dist/src/toolbar/HTMLToolbar.d.ts +1 -0
- package/dist/src/toolbar/HTMLToolbar.js +10 -8
- package/dist/src/toolbar/icons.js +13 -13
- package/dist/src/toolbar/localization.d.ts +2 -0
- package/dist/src/toolbar/localization.js +2 -0
- package/dist/src/toolbar/makeColorInput.js +22 -8
- package/dist/src/toolbar/widgets/BaseWidget.js +29 -0
- package/dist/src/toolbar/widgets/HandToolWidget.js +8 -1
- package/dist/src/tools/BaseTool.d.ts +2 -1
- package/dist/src/tools/BaseTool.js +3 -0
- package/dist/src/tools/PanZoom.d.ts +2 -1
- package/dist/src/tools/PanZoom.js +10 -4
- package/dist/src/tools/SelectionTool.d.ts +9 -2
- package/dist/src/tools/SelectionTool.js +131 -19
- package/dist/src/tools/ToolController.js +6 -2
- package/dist/src/tools/localization.d.ts +1 -0
- package/dist/src/tools/localization.js +1 -0
- package/dist/src/types.d.ts +9 -2
- package/dist/src/types.js +1 -0
- package/package.json +9 -1
- package/src/Editor.ts +54 -14
- package/src/UndoRedoHistory.ts +4 -0
- package/src/Viewport.ts +2 -0
- package/src/bundle/bundled.ts +2 -1
- package/src/geometry/LineSegment2.test.ts +15 -0
- package/src/geometry/LineSegment2.ts +20 -0
- package/src/geometry/Rect2.test.ts +20 -7
- package/src/geometry/Rect2.ts +19 -1
- package/src/localizations/en.ts +8 -0
- package/src/localizations/es.ts +62 -0
- package/src/localizations/getLocalizationTable.test.ts +27 -0
- package/src/localizations/getLocalizationTable.ts +53 -0
- package/src/toolbar/HTMLToolbar.ts +11 -9
- package/src/toolbar/icons.ts +13 -13
- package/src/toolbar/localization.ts +4 -0
- package/src/toolbar/makeColorInput.ts +25 -10
- package/src/toolbar/toolbar.css +6 -2
- package/src/toolbar/widgets/BaseWidget.ts +34 -0
- package/src/toolbar/widgets/HandToolWidget.ts +12 -1
- package/src/tools/BaseTool.ts +5 -1
- package/src/tools/PanZoom.ts +13 -4
- package/src/tools/SelectionTool.test.ts +24 -1
- package/src/tools/SelectionTool.ts +158 -23
- package/src/tools/ToolController.ts +6 -2
- package/src/tools/localization.ts +2 -0
- package/src/types.ts +10 -1
- package/dist-test/test-dist-bundle.html +0 -42
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 0.1.11
|
2
|
+
* Fix 'Enter' key not toggling toolbar buttons.
|
3
|
+
* Add zoom limits.
|
4
|
+
* Add a reset zoom button.
|
5
|
+
|
6
|
+
# 0.1.10
|
7
|
+
* Keyboard shortcuts for the selection tool.
|
8
|
+
* Scroll the selection into view while moving it with the keyboard/mouse.
|
9
|
+
* Fix toolbar buttons not activating when focused and enter/space is pressed.
|
10
|
+
* Partial Spanish localization.
|
11
|
+
|
12
|
+
# 0.1.9
|
13
|
+
* Fix regression -- color picker hides just after clicking it.
|
14
|
+
* Allow toggling the pipette tool.
|
15
|
+
|
1
16
|
# 0.1.8
|
2
17
|
* Don't render if the screen has a size of 0x0.
|
3
18
|
* This was breaking the cache data structure's invariant -- cache blocks weren't dividing when they had zero size.
|
package/README.md
CHANGED
@@ -118,9 +118,21 @@ const editor = new Editor(document.body, {
|
|
118
118
|
|
119
119
|
### Localization
|
120
120
|
|
121
|
-
|
121
|
+
If a user's language is available in [src/localizations/](src/localizations/) (as determined by `navigator.languages`), that localization will be used.
|
122
122
|
|
123
|
-
|
123
|
+
To override the default language, use `getLocalizationTable([ 'custom locale here' ])`. For example,
|
124
|
+
```ts
|
125
|
+
const editor = new Editor(document.body, {
|
126
|
+
// Force the Spanish (Español) localizaiton
|
127
|
+
localization: getLocalizationTable([ 'es' ]),
|
128
|
+
});
|
129
|
+
```
|
130
|
+
|
131
|
+
<details><summary>Creating a custom localization</summary>
|
132
|
+
|
133
|
+
See [src/localization.ts](src/localization.ts) for a list of strings that can be translated.
|
134
|
+
|
135
|
+
Many of the default strings in the editor might be overridden like this:
|
124
136
|
```ts
|
125
137
|
const editor = new Editor(document.body, {
|
126
138
|
// Example partial Spanish localization
|
@@ -141,7 +153,6 @@ const editor = new Editor(document.body, {
|
|
141
153
|
pen: 'Lapiz',
|
142
154
|
eraser: 'Borrador',
|
143
155
|
select: 'Selecciona',
|
144
|
-
touchDrawing: 'Dibuja con un dedo',
|
145
156
|
thicknessLabel: 'Tamaño: ',
|
146
157
|
colorLabel: 'Color: ',
|
147
158
|
|
@@ -150,6 +161,7 @@ const editor = new Editor(document.body, {
|
|
150
161
|
});
|
151
162
|
```
|
152
163
|
|
164
|
+
</details>
|
153
165
|
|
154
166
|
## Changing the editor's color theme
|
155
167
|
|