mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
added MouseConstraint.create warning for omitted element
This commit is contained in:
parent
af83e27ff0
commit
b6603ca290
1 changed files with 8 additions and 1 deletions
|
@ -22,7 +22,14 @@ var MouseConstraint = {};
|
|||
* @return {MouseConstraint} A new MouseConstraint
|
||||
*/
|
||||
MouseConstraint.create = function(engine, options) {
|
||||
var mouse = (options && options.mouse) || Mouse.create(engine.render.canvas);
|
||||
var mouse = (engine ? engine.mouse : null) || (options ? options.mouse : null);
|
||||
|
||||
if (!mouse && engine && engine.render && engine.render.canvas) {
|
||||
mouse = Mouse.create(engine.render.canvas);
|
||||
} else {
|
||||
mouse = Mouse.create();
|
||||
Common.log('MouseConstraint.create: options.mouse was undefined, engine.render.canvas was undefined, may not function as expected', 'warn');
|
||||
}
|
||||
|
||||
var constraint = Constraint.create({
|
||||
label: 'Mouse Constraint',
|
||||
|
|
Loading…
Reference in a new issue