Skip to content

Commit de4c45e

Browse files
committed
Fixed sprite dragging (see template)
1 parent 321be68 commit de4c45e

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

index.bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ <h2 id="updates">Update history</h2>
129129
See the code and previous versions on
130130
<a href="https://github.com/SheepTester/htmlifier/">Github</a>.
131131
</p>
132+
<h3>
133+
2021-08-09 (<a
134+
href="https://github.com/SheepTester/htmlifier/releases/download/v1.0.1/htmlifier-offline.html"
135+
>download</a
136+
>)
137+
</h3>
138+
<ul>
139+
<li>Fixed sprite dragging.</li>
140+
</ul>
132141
<h3>
133142
2021-08-08 (<a
134143
href="https://github.com/SheepTester/htmlifier/releases/download/v1.0.0/htmlifier-offline.html"

node/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sheeptester/htmlifier",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Packages a Scratch project in an HTML file with no optimisations.",
55
"type": "module",
66
"main": "index.min.js",

src/template/template.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,11 @@ window.init = async ({ width, height, ...options }) => {
558558
canvasWidth: rect.width,
559559
canvasHeight: rect.height
560560
})
561-
return mousePosition
561+
return { mousePosition, rect }
562562
}
563563
function handleMouseMove (event) {
564564
if (postIfPointerLocked(event)) return
565-
const mousePosition = postMouse(event)
565+
const { mousePosition, rect } = postMouse(event)
566566
if (mouseDown && !isDragging) {
567567
const distanceFromMouseDown = Math.hypot(
568568
mousePosition.x - mouseDownPosition.x,
@@ -594,7 +594,7 @@ window.init = async ({ width, height, ...options }) => {
594594
isDown: true
595595
})
596596
if (postIfPointerLocked(event, true)) return
597-
mouseDownPosition = postMouse(event, true)
597+
mouseDownPosition = postMouse(event, true).mousePosition
598598
mouseDownTimeoutId = setTimeout(handleStartDrag, 400)
599599
event.preventDefault()
600600
if (!document.body.classList.contains('asking')) {

0 commit comments

Comments
 (0)