Skip to content

Commit 4e6916c

Browse files
committed
bug: keyb up/down scrolling
1 parent 1eca69b commit 4e6916c

5 files changed

Lines changed: 15 additions & 16 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [1.0.0]
44
- Changed default palette from Sonic 2 to the SCH unified palette
5+
- Fixed a bug that allows deleting mappings in drawing mode
6+
- Fixed a bug where up/down scrolls when there are active mappings
57

68
## [0.0.7]
79
- Added changelog

app/components/mappings/state/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class MappingState {
155155
};
156156

157157
@computed get center() {
158-
if (!this.activeMappings.length) return void 0;
158+
if (!this.activeMappings.length) return;
159159

160160
return getCenter(this.activeMappings);
161161
}

app/controls/commands.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export const commands = [
189189
{
190190
map: 'up', name: 'Move Up', hasShift: true, color: 'white',
191191
func: (e) => {
192-
e && e.preventDefault();
192+
mappingState.hasActive && e.preventDefault();
193193
mappingState.mutateActive((mapping) => {
194194
mapping.top -= getDistance();
195195
});
@@ -198,7 +198,7 @@ export const commands = [
198198
{
199199
map: 'down', name: 'Move Down', hasShift: true, color: 'white',
200200
func: (e) => {
201-
e && e.preventDefault();
201+
mappingState.hasActive && e.preventDefault();
202202
mappingState.mutateActive((mapping) => {
203203
mapping.top += getDistance();
204204
});
@@ -209,21 +209,15 @@ export const commands = [
209209
[
210210
{
211211
map: 'e', name: 'Export PNG', color: 'blue', noMultiplier: true,
212-
func: () => {
213-
exportPNG();
214-
},
212+
func: exportPNG,
215213
},
216214
{
217215
map: 'i', name: 'Import Over Sprite', color: 'blue', noMultiplier: true,
218-
func: () => {
219-
importImg();
220-
},
216+
func: importImg,
221217
},
222218
{
223219
map: 's', name: 'Import Spritesheet', color: 'blue', noMultiplier: true,
224-
func: () => {
225-
importState.newImport();
226-
},
220+
func: importState.newImport,
227221
},
228222
],
229223

app/controls/keyboard.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import flatten from 'lodash/flatten';
77
flatten(commands)
88
.forEach((obj) => {
99
if (obj.hasShift) {
10-
Mousetrap.bind([obj.map, `shift+${obj.map}`], () => doCommand(obj));
10+
Mousetrap.bind([obj.map, `shift+${obj.map}`], doCommand.bind(null, obj));
1111
}
1212
else {
13-
Mousetrap.bind(obj.map, () => doCommand(obj));
13+
Mousetrap.bind(obj.map, doCommand.bind(null, obj));
1414
}
1515
});
1616

@@ -22,14 +22,14 @@ Mousetrap.bind(['0','1','2','3','4','5','6','7','8','9'], (e) => {
2222
Mousetrap.bind('esc', () => {
2323
multiplier = '';
2424
});
25-
function doCommand(obj) {
25+
function doCommand(obj, e) {
2626
environment.doAction(() => {
2727
if (!obj.noMultiplier && multiplier) {
2828
for (let i = 0; i < +multiplier; i++) obj.func();
2929
multiplier = '';
3030
}
3131
else {
32-
obj.func();
32+
obj.func(e);
3333
}
3434
});
3535
}

app/formats/scripts/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
// next: file menu + custom loader
2+
//
13
// script language
24

35
// padding / fill
46
// optimizations(false);
57
// loadASM();
8+
// customOffset()
69
// mappingHeader -> index 0
710
// reverse endianness
811
// end tokens

0 commit comments

Comments
 (0)