Fix handling of stack click

Previously was improperly reading `e.type`.
This commit is contained in:
Tim Mickel 2016-06-01 13:48:54 -04:00
parent 1ab391281d
commit 9ce3783940
3 changed files with 17 additions and 11 deletions

View file

@ -28,7 +28,13 @@ function VirtualMachine () {
if (typeof e !== 'object') return;
if (typeof e.blockId !== 'string') return;
// Blocks
// UI event: clicked stacks toggle in the runtime.
if (e.element === 'stackclick') {
instance.runtime.toggleStack(e.blockId);
return;
}
// Block create/update/destroy
switch (e.type) {
case 'create':
instance.runtime.createBlock(adapter(e), false);
@ -55,9 +61,6 @@ function VirtualMachine () {
id: e.blockId
});
break;
case 'stackclick':
instance.runtime.toggleStack(e.blockId);
break;
}
};

11
vm.js
View file

@ -74,7 +74,13 @@
if (typeof e !== 'object') return;
if (typeof e.blockId !== 'string') return;
// Blocks
// UI event: clicked stacks toggle in the runtime.
if (e.element === 'stackclick') {
instance.runtime.toggleStack(e.blockId);
return;
}
// Block create/update/destroy
switch (e.type) {
case 'create':
instance.runtime.createBlock(adapter(e), false);
@ -101,9 +107,6 @@
id: e.blockId
});
break;
case 'stackclick':
instance.runtime.toggleStack(e.blockId);
break;
}
};

6
vm.min.js vendored

File diff suppressed because one or more lines are too long