diff --git a/ShadowEditor.Web/src/editor/StatusBar.js b/ShadowEditor.Web/src/editor/StatusBar.js index 1d28a44e..f4034d39 100644 --- a/ShadowEditor.Web/src/editor/StatusBar.js +++ b/ShadowEditor.Web/src/editor/StatusBar.js @@ -53,7 +53,6 @@ StatusBar.prototype.render = function () { }, { xtype: 'checkbox', id: 'cbThrowBall', - scope: this.id, onChange: this.onEnableThrowBall.bind(this) }] }] @@ -111,7 +110,7 @@ StatusBar.prototype.onUpdateInfo = function () { }; StatusBar.prototype.onEnableThrowBall = function () { - var enabled = UI.get('cbThrowBall', this.id); + var enabled = UI.get('cbThrowBall'); this.app.call('enableThrowBall', this, enabled.getValue()); }; diff --git a/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js b/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js index ef002a13..19f04750 100644 --- a/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js +++ b/ShadowEditor.Web/src/player/component/physics/ThrowBallEvent.js @@ -22,6 +22,9 @@ ThrowBallEvent.prototype.create = function (scene, camera, renderer) { this.scene = scene; this.camera = camera; this.renderer = renderer; + + this.enabled = UI.get('cbThrowBall').getValue(); + this.app.on(`click.${this.id}`, this.throwBall.bind(this)); this.app.on(`enableThrowBall.${this.id}`, this.onEnableThrowBall.bind(this)); };