Skip to content

Commit d99b349

Browse files
committed
Massive changelog, and fix left/right detection-ish
Reproduction: 1. Press and hold ShiftLeft 2. Press and hold ShiftRight 3. Release ShiftLeft. This does not fire a mouseup event. 4. Release ShiftRight. `code` is ShiftRight. mouseup with code=ShiftLeft never fires.
1 parent 9738baa commit d99b349

3 files changed

Lines changed: 53 additions & 5 deletions

File tree

index.html

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,41 @@ <h3><em>Convert a Scratch project to HTML</em></h3>
7070
<div id="notes"></div>
7171
<h2 id="updates">Update history</h2>
7272
<p>See the code and previous versions on <a href="https://github.com/SheepTester/htmlifier/">Github</a>.</p>
73-
<h3>Upcoming</h3>
73+
<h3>2021-02-07 (<a href="https://github.com/SheepTester/htmlifier/releases/download/2021-02-07/htmlifier-offline.html">download</a>)</h3>
7474
<ul>
75+
<li>Save the options in the URL</li>
76+
<li>
77+
New customisation options:
78+
<ul>
79+
<li>Background image</li>
80+
<li>Cursor</li>
81+
<li>Favicon</li>
82+
<li>New loading bar design with customisable colours</li>
83+
<li>
84+
Loading screen image from a URL
85+
<ul>
86+
<li>Option to stretch only the loading screen image</li>
87+
</ul>
88+
</li>
89+
</ul>
90+
</li>
91+
<li>Option to show start/stop buttons (equivalent to the green flag/stop sign)</li>
92+
<li>
93+
New special cloud behaviours:
94+
<ul>
95+
<li>Better support for <code>☁ eval</code> returning Promises</li>
96+
<li><code>☁ open link</code> opens a URL in a new tab.</li>
97+
<li><code>☁ redirect</code> redirects to a URL.</li>
98+
<li><code>☁ set clipboard</code> tries to copy text to the clipboard.</li>
99+
<li><code>☁ set server ip</code> changes the cloud server URL.</li>
100+
</ul>
101+
</li>
102+
<li>Ability to distinguish between left/right modifier keys using <code>&lt;key (join [code_ShiftLeft] []) pressed?>&gt;</code>, for example.</li>
103+
<li>Clicking on a variable slider no longer gives it focus, so keys will continue to work.</li>
104+
<li>A bookmarklet creator</li>
105+
<li>BREAKING: The mouse lock position now sets mouse x/y to the accumulative mouse position, which should be more reliable. This works best with the "Remove limits" option.</li>
106+
<li>Updated CSS by <a href="https://scratch.mit.edu/users/mrcringekidyt/">Mr. Cringe Kid</a></li>
107+
<li>Fixed the HTMLification log progress not resetting</li>
75108
<li>Also, the <a href="https://github.com/SheepTester/primitive-cloud-server">primitive cloud server</a> has been updated.</li>
76109
</ul>
77110
<h3>2020-12-18</h3>
@@ -624,10 +657,11 @@ <h2 id="see-also">See also</h2>
624657
}
625658
), 'url')
626659
)
627-
.add(
628-
new Label('Include the project data in the HTML file? This will make the file larger, but it will work offline. (Must be checked if uploading a file.)')
629-
.addCheckable(new Checkbox('include-file', true))
630-
)
660+
// TODO
661+
// .add(
662+
// new Label('Include the project data in the HTML file? This will make the file larger, but it will work offline. (Must be checked if uploading a file.)')
663+
// .addCheckable(new Checkbox('include-file', true))
664+
// )
631665
.add(
632666
new Fieldset('Options')
633667
.add(new Input(

offlineifier.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ function offlineify ({
3737
.catch(problemFetching('the Scratch engine'))
3838
.then(toText('the Scratch engine'))
3939
.then(async vmCode => {
40+
// TODO: ??? What happened here, with `extensionWorkerGet` being
41+
// undefined and `extensionWorker` being unused?
4042
let extensionWorker
4143
const extensionWorkerMatch = vmCode.match(extensionWorkerGet)
4244
if (!extensionWorkerMatch) throw new Error('Cannot find extension-worker.js')

template.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -981,17 +981,28 @@
981981

982982
// KEY PRESSED?
983983
/* https://github.com/LLK/scratch-gui/blob/develop/src/lib/vm-listener-hoc.jsx#L86-L115 */
984+
const keyToCode = new Map()
984985
document.addEventListener('keydown', e => {
985986
if (e.target !== document && e.target !== document.body) return;
986987
const key = !e.key || e.key === 'Dead' ? e.keyCode : e.key;
987988
vm.postIOData('keyboard', {
988989
key: key,
989990
isDown: true
990991
});
992+
const prevCode = keyToCode.get(e.key);
993+
if (prevCode) {
994+
if (prevCode !== e.code) {
995+
vm.postIOData('keyboard', {
996+
key: 'code_' + prevCode,
997+
isDown: false
998+
});
999+
}
1000+
}
9911001
vm.postIOData('keyboard', {
9921002
key: 'code_' + e.code,
9931003
isDown: true
9941004
});
1005+
keyToCode.set(e.key, e.code);
9951006
if (e.keyCode === 32 || e.keyCode >= 37 && e.keyCode <= 40) {
9961007
e.preventDefault();
9971008
}
@@ -1006,6 +1017,7 @@
10061017
key: 'code_' + e.code,
10071018
isDown: false
10081019
});
1020+
keyToCode.delete(e.key);
10091021
if (e.target !== document && e.target !== document.body) {
10101022
e.preventDefault();
10111023
}

0 commit comments

Comments
 (0)