Gyro tutorials (#930)

* gyro tutorials

* tutorials

* fix gyro simulator

* images

* updated image

* fix svg errors
This commit is contained in:
Peli de Halleux
2019-09-30 22:43:50 -07:00
committed by GitHub
parent cb816c91ad
commit 80b9c715b2
12 changed files with 175 additions and 8 deletions

View File

@ -49,11 +49,13 @@ namespace pxsim.visuals {
}
private updateDimensions(width: number, height: number, strict?: boolean) {
width = Math.max(0, width);
height = Math.max(0, height);
if (this.content) {
const currentWidth = this.getInnerWidth();
const currentHeight = this.getInnerHeight();
const newHeight = currentHeight / currentWidth * width;
const newWidth = currentWidth / currentHeight * height;
const newHeight = Math.max(0, currentHeight / currentWidth * width);
const newWidth = Math.max(0, currentWidth / currentHeight * height);
if (strict) {
this.content.setAttribute('width', `${width}`);
this.content.setAttribute('height', `${height}`);