@robotical/martyblocksjr 4.2.13 → 4.2.14

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 (29) hide show
  1. package/editions/free/src/app.bundle.js +1 -1
  2. package/editions/free/src/css/editor.css +20 -2
  3. package/editions/free/src/localizations/bg.json +1 -1
  4. package/editions/free/src/localizations/ca.json +1 -1
  5. package/editions/free/src/localizations/cs.json +1 -1
  6. package/editions/free/src/localizations/cy.json +1 -1
  7. package/editions/free/src/localizations/da.json +1 -1
  8. package/editions/free/src/localizations/de.json +1 -1
  9. package/editions/free/src/localizations/el.json +1 -1
  10. package/editions/free/src/localizations/en.json +1 -1
  11. package/editions/free/src/localizations/es.json +1 -1
  12. package/editions/free/src/localizations/fi.json +1 -1
  13. package/editions/free/src/localizations/fr.json +1 -1
  14. package/editions/free/src/localizations/it.json +1 -1
  15. package/editions/free/src/localizations/ja.json +1 -1
  16. package/editions/free/src/localizations/ko.json +1 -1
  17. package/editions/free/src/localizations/nl.json +1 -1
  18. package/editions/free/src/localizations/no.json +1 -1
  19. package/editions/free/src/localizations/pl.json +1 -1
  20. package/editions/free/src/localizations/pt-br.json +1 -1
  21. package/editions/free/src/localizations/pt.json +1 -1
  22. package/editions/free/src/localizations/sv.json +1 -1
  23. package/editions/free/src/localizations/th.json +1 -1
  24. package/editions/free/src/localizations/tr.json +1 -1
  25. package/editions/free/src/localizations/uk.json +1 -1
  26. package/editions/free/src/localizations/zh-cn.json +1 -1
  27. package/editions/free/src/localizations/zh-tw.json +1 -1
  28. package/package.json +1 -1
  29. package/tests/Zoom.test.js +59 -0
@@ -2082,12 +2082,30 @@ p.textsprite {
2082
2082
  -webkit-text-size-adjust: auto;
2083
2083
  }
2084
2084
 
2085
- .zoom-button {
2085
+ .zoom-controls {
2086
2086
  position: absolute;
2087
2087
  bottom: 10px;
2088
2088
  right: 10px;
2089
+ display: flex;
2090
+ z-index: 1000;
2091
+ }
2092
+
2093
+ .zoom-button {
2089
2094
  width: 50px;
2090
2095
  height: 50px;
2096
+ margin: 0;
2097
+ padding: 0;
2098
+ border: 0;
2099
+ background: transparent;
2091
2100
  cursor: pointer;
2092
- z-index: 1000;
2101
+ }
2102
+
2103
+ .zoom-button + .zoom-button {
2104
+ margin-left: 8px;
2105
+ }
2106
+
2107
+ .zoom-button svg {
2108
+ display: block;
2109
+ width: 100%;
2110
+ height: 100%;
2093
2111
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1304,5 +1304,5 @@
1304
1304
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1305
1305
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1306
1306
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1307
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1307
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1308
1308
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
@@ -1211,5 +1211,5 @@
1211
1211
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES": "{N, number} | Device Block Categories",
1212
1212
  "INTERFACE_GUIDE_DEVICE_BLOCK_CATEGORIES_DESCRIPTION": "Choose Cog blocks. Optional device categories, such as micro:bit, appear here when their extension is enabled.",
1213
1213
  "INTERFACE_GUIDE_ZOOM": "{N, number} | Script Zoom",
1214
- "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Press and hold to zoom out for an overview of the programming area; release to return to normal size."
1214
+ "INTERFACE_GUIDE_ZOOM_DESCRIPTION": "Use the minus and plus buttons to zoom the programming area out or in by 20% per click."
1215
1215
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robotical/martyblocksjr",
3
- "version": "4.2.13",
3
+ "version": "4.2.14",
4
4
  "description": "ScratchJr",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,59 @@
1
+ import {describe, expect, it} from 'vitest';
2
+ import Zoom from '../src/editor/ui/Zoom';
3
+
4
+ describe('script editor zoom', () => {
5
+ it('zooms out and in persistently in 20% steps', () => {
6
+ const scriptsContainer = {style: {}};
7
+ const zoom = new Zoom(scriptsContainer);
8
+
9
+ zoom.zoomOut();
10
+ expect(zoom.zoomLevel).toBe(0.8);
11
+ expect(scriptsContainer.style.transform).toBe('scale(0.8)');
12
+
13
+ zoom.zoomOut();
14
+ expect(zoom.zoomLevel).toBe(0.6);
15
+ expect(scriptsContainer.style.transform).toBe('scale(0.6)');
16
+
17
+ zoom.zoomIn();
18
+ expect(zoom.zoomLevel).toBe(0.8);
19
+ expect(scriptsContainer.style.transform).toBe('scale(0.8)');
20
+ });
21
+
22
+ it('keeps zoom within the supported range', () => {
23
+ const scriptsContainer = {style: {}};
24
+ const zoom = new Zoom(scriptsContainer);
25
+
26
+ for (let i = 0; i < 20; i++) {
27
+ zoom.zoomOut();
28
+ }
29
+ expect(zoom.zoomLevel).toBe(0.2);
30
+ expect(scriptsContainer.style.transform).toBe('scale(0.2)');
31
+
32
+ for (let i = 0; i < 20; i++) {
33
+ zoom.zoomIn();
34
+ }
35
+ expect(zoom.zoomLevel).toBe(2);
36
+ expect(scriptsContainer.style.transform).toBe('scale(2)');
37
+ });
38
+
39
+ it('maps screen coordinates back into the zoomed scripts canvas', () => {
40
+ const scriptsContainer = {
41
+ style: {},
42
+ offsetWidth: 500,
43
+ offsetHeight: 300,
44
+ getBoundingClientRect: () => ({
45
+ left: 100,
46
+ top: 50,
47
+ width: 400,
48
+ height: 240
49
+ })
50
+ };
51
+ const zoom = new Zoom(scriptsContainer);
52
+
53
+ expect(zoom.getLocalPoint(scriptsContainer, 260, 170)).toEqual({
54
+ x: 200,
55
+ y: 150
56
+ });
57
+ expect(zoom.getRenderedScale()).toBe(0.8);
58
+ });
59
+ });