js-draw 0.1.3 → 0.1.6
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 +13 -0
- package/README.md +21 -12
- package/dist/bundle.js +1 -1
- package/dist/src/Editor.d.ts +2 -1
- package/dist/src/Editor.js +19 -4
- package/dist/src/SVGLoader.js +6 -2
- package/dist/src/Viewport.d.ts +1 -1
- package/dist/src/Viewport.js +5 -5
- package/dist/src/components/Text.js +3 -1
- package/dist/src/localization.d.ts +2 -1
- package/dist/src/localization.js +2 -1
- package/dist/src/rendering/Display.d.ts +2 -0
- package/dist/src/rendering/Display.js +19 -0
- package/dist/src/rendering/localization.d.ts +5 -0
- package/dist/src/rendering/localization.js +4 -0
- package/dist/src/rendering/renderers/TextOnlyRenderer.d.ts +24 -0
- package/dist/src/rendering/renderers/TextOnlyRenderer.js +40 -0
- package/dist/src/toolbar/HTMLToolbar.js +27 -1
- package/dist/src/toolbar/icons.js +1 -0
- package/dist/src/toolbar/localization.d.ts +1 -0
- package/dist/src/toolbar/localization.js +1 -0
- package/dist/src/tools/TextTool.d.ts +2 -0
- package/dist/src/tools/TextTool.js +25 -5
- package/dist-test/test-dist-bundle.html +8 -1
- package/package.json +1 -1
- package/src/Editor.css +12 -0
- package/src/Editor.ts +20 -5
- package/src/SVGLoader.ts +7 -2
- package/src/Viewport.ts +5 -5
- package/src/components/Text.ts +5 -1
- package/src/localization.ts +3 -1
- package/src/rendering/Display.ts +26 -0
- package/src/rendering/localization.ts +10 -0
- package/src/rendering/renderers/TextOnlyRenderer.ts +51 -0
- package/src/toolbar/HTMLToolbar.ts +34 -2
- package/src/toolbar/icons.ts +1 -0
- package/src/toolbar/localization.ts +2 -0
- package/src/toolbar/toolbar.css +6 -3
- package/src/tools/TextTool.ts +27 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
# 0.1.6
|
2
|
+
* Fix loading text in SVG images in Chrome.
|
3
|
+
|
4
|
+
# 0.1.5
|
5
|
+
* Add a text-only renderer (only renders text objects at present) that can be activated with a screen reader.
|
6
|
+
* Make new text objects parallel to screen's horizontal axis.
|
7
|
+
* Fix pinch zoom off center when embedded in larger page.
|
8
|
+
|
9
|
+
# 0.1.4
|
10
|
+
* Option to enable pan gestures only if the editor has focus
|
11
|
+
* Text tool bug fixes and improvements.
|
12
|
+
* Defocus/blur editor when `Esc` key is pressed.
|
13
|
+
|
1
14
|
# 0.1.3
|
2
15
|
* Very minimalistic text tool.
|
3
16
|
* Ability to load and save text.
|
package/README.md
CHANGED
@@ -36,8 +36,8 @@ const editor = new Editor(document.body);
|
|
36
36
|
### Without a bundler
|
37
37
|
If you're not using a bundler, consider using the pre-bundled editor:
|
38
38
|
```html
|
39
|
-
<!-- Replace 0.1.
|
40
|
-
<script src="https://cdn.jsdelivr.net/npm/js-draw@0.1.
|
39
|
+
<!-- Replace 0.1.5 with the latest version of js-draw -->
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/js-draw@0.1.5/dist/bundle.js"></script>
|
41
41
|
<script>
|
42
42
|
const editor = new jsdraw.Editor(document.body);
|
43
43
|
editor.addToolbar();
|
@@ -109,6 +109,13 @@ const editor = new Editor(document.body, {
|
|
109
109
|
});
|
110
110
|
```
|
111
111
|
|
112
|
+
Alternatively, to only enable touchpad panning when the editor has focus,
|
113
|
+
```ts
|
114
|
+
const editor = new Editor(document.body, {
|
115
|
+
wheelEventsEnabled: 'only-if-focused',
|
116
|
+
});
|
117
|
+
```
|
118
|
+
|
112
119
|
### Localization
|
113
120
|
|
114
121
|
See [src/localization.ts](src/localization.ts) for a list of strings.
|
@@ -149,25 +156,27 @@ const editor = new Editor(document.body, {
|
|
149
156
|
The editor's color theme is specified using CSS. Its default theme looks like this:
|
150
157
|
```css
|
151
158
|
.imageEditorContainer {
|
152
|
-
|
159
|
+
/* Deafult colors for the editor -- light mode */
|
153
160
|
|
154
161
|
--primary-background-color: white;
|
155
162
|
--primary-background-color-transparent: rgba(255, 255, 255, 0.5);
|
156
163
|
--secondary-background-color: #faf;
|
157
164
|
--primary-foreground-color: black;
|
158
165
|
--secondary-foreground-color: black;
|
166
|
+
--primary-shadow-color: rgba(0, 0, 0, 0.5);
|
159
167
|
}
|
160
168
|
|
161
169
|
@media (prefers-color-scheme: dark) {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
170
|
+
.imageEditorContainer {
|
171
|
+
/* Deafult colors for the editor -- dark mode */
|
172
|
+
|
173
|
+
--primary-background-color: #151515;
|
174
|
+
--primary-background-color-transparent: rgba(50, 50, 50, 0.5);
|
175
|
+
--secondary-background-color: #607;
|
176
|
+
--primary-foreground-color: white;
|
177
|
+
--secondary-foreground-color: white;
|
178
|
+
--primary-shadow-color: rgba(250, 250, 250, 0.5);
|
179
|
+
}
|
171
180
|
}
|
172
181
|
```
|
173
182
|
|