scratchfoundation / scratchfoundation/scratch-blocks
Workspace zoom wheel throws typeErrors
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 1.6k
- Avg merge
- 4h 51m
- Merged PRs (30d)
- 12
Description
Expected Behavior
Blockly workspace in a fully-expanding
(css below) should be able to use the mouse wheel to zoom in an out. <style> #blocklyDiv { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } </style>Actual Behavior
Using mouse wheel throws the following exception:
blockly_compressed_horizontal.js:1009 Uncaught TypeError: Cannot read property 'set' of null
at Blockly.WorkspaceSvg.scroll (blockly_compressed_horizontal.js:1009)
at Blockly.WorkspaceSvg.onMouseWheel_ (blockly_compressed_horizontal.js:995)
at SVGGElement.h (blockly_compressed_horizontal.js:2198)
Blockly.WorkspaceSvg.scroll @ blockly_compressed_horizontal.js:1009
Blockly.WorkspaceSvg.onMouseWheel_ @ blockly_compressed_horizontal.js:995
h @ blockly_compressed_horizontal.js:2198
Steps to Reproduce
Attached is a highly-reduced HTML file that reproduces the issue. Place this file in a node project that has scratch blocks installed (I'm using "scratch-blocks": "0.1.0-prerelease.1564769819")
- Open the file in your browser (I use Intellij's "load in browser" feature)
- Open JS console
- scroll mouse wheel (or track pad, same bug)
See the javascript TypeError in the console.
This bug appears in both vertical and horizontal layouts. It appears with or without blocks in the workspace, or in the toolbox.
Operating System and Browser
Mac OS 10.14.6 Safari 12.1.2, Chrome 76.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the attached reduced HTML in a browser, then inspect Blockly.WorkspaceSvg.onMouseWheel_ and Blockly.WorkspaceSvg.scroll in blockly_compressed_horizontal.js. Confirm the fix in both vertical and horizontal layouts, with and without blocks or a toolbox, by verifying that mouse-wheel zoom no longer throws a TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100