This commit is contained in:
Peli de Halleux 2016-11-07 13:30:53 -08:00
commit 3f94033c7d
2 changed files with 4 additions and 3 deletions

View File

@ -15,7 +15,7 @@ The local server allows to run the editor and the documentation from your comput
The following commands are a 1-time setup after synching the repo on your machine. The following commands are a 1-time setup after synching the repo on your machine.
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/) * See requirements for [pxt](https://github.com/Microsoft/pxt)
* [clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer and go in the project folder * [clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer and go in the project folder
``` ```
git clone https://github.com/microsoft/pxt-microbit git clone https://github.com/microsoft/pxt-microbit

View File

@ -712,8 +712,9 @@ namespace pxsim.visuals {
tiltDecayer = 0; tiltDecayer = 0;
} }
let ax = (ev.clientX - this.element.clientWidth / 2) / (this.element.clientWidth / 3); let bbox = this.element.getBoundingClientRect();
let ay = (ev.clientY - this.element.clientHeight / 2) / (this.element.clientHeight / 3); let ax = (ev.clientX - bbox.width / 2) / (bbox.width / 3);
let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3);
let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023))); let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023)));
let y = Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023))); let y = Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023)));