mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #215 : Dev environment : support keyboard/undo/redo events in drawing tests
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
ns.DrawingTestRecorder.prototype.init = function () {
|
||||
$.subscribe(Events.MOUSE_EVENT, this.onMouseEvent_.bind(this));
|
||||
$.subscribe(Events.KEYBOARD_EVENT, this.onKeyboardEvent_.bind(this));
|
||||
$.subscribe(Events.TOOL_SELECTED, this.onToolEvent_.bind(this));
|
||||
$.subscribe(Events.PRIMARY_COLOR_SELECTED, this.onColorEvent_.bind(this, true));
|
||||
$.subscribe(Events.SECONDARY_COLOR_SELECTED, this.onColorEvent_.bind(this, false));
|
||||
@@ -73,6 +74,23 @@
|
||||
}
|
||||
};
|
||||
|
||||
ns.DrawingTestRecorder.prototype.onKeyboardEvent_ = function (evt, keyboardEvent) {
|
||||
if (this.isRecording) {
|
||||
var recordEvent = {};
|
||||
recordEvent.type = 'keyboard-event';
|
||||
recordEvent.event = {
|
||||
which : keyboardEvent.which,
|
||||
shiftKey : keyboardEvent.shiftKey,
|
||||
altKey : keyboardEvent.altKey,
|
||||
ctrlKey : keyboardEvent.ctrlKey,
|
||||
target : {
|
||||
nodeName : keyboardEvent.target.nodeName
|
||||
}
|
||||
};
|
||||
this.events.push(recordEvent);
|
||||
}
|
||||
};
|
||||
|
||||
ns.DrawingTestRecorder.prototype.onColorEvent_ = function (isPrimary, evt, color) {
|
||||
if (this.isRecording) {
|
||||
var recordEvent = {};
|
||||
|
||||
Reference in New Issue
Block a user