scratchfoundation / scratchfoundation/scratch-blocks

Workspace zoom wheel throws typeErrors

Open
#1,984 2 comments 0 reactions 0 assignees View on GitHub

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")

  1. Open the file in your browser (I use Intellij's "load in browser" feature)
  2. Open JS console
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.