mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-20 22:39:50 -05:00
The paper.browser object might not be initialized yet.
This commit is contained in:
parent
26761f17a1
commit
88634d4d3d
1 changed files with 4 additions and 2 deletions
|
@ -67,7 +67,8 @@ var Key = new function() {
|
|||
// based on whichever key is used for commands.
|
||||
command: {
|
||||
get: function() {
|
||||
return paper.browser.mac ? this.meta : this.control;
|
||||
var browser = paper.browser;
|
||||
return browser && browser.mac ? this.meta : this.control;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -107,7 +108,8 @@ var Key = new function() {
|
|||
// Detect modifiers and mark them as pressed / released
|
||||
if (key.length > 1 && (name = Base.camelize(key)) in modifiers) {
|
||||
modifiers[name] = down;
|
||||
if (name === 'meta' && paper.browser.mac) {
|
||||
var browser = paper.browser;
|
||||
if (name === 'meta' && browser && browser.mac) {
|
||||
// Fix a strange behavior on Mac where no keyup events are
|
||||
// received for any keys pressed while the meta key is down.
|
||||
// Keep track of the normal keys being pressed and trigger keyup
|
||||
|
|
Loading…
Reference in a new issue