Commit 1b4d585c authored by Michael Ochmann's avatar Michael Ochmann
Browse files

upscaled canvas for hidpi

parent d422cd40
...@@ -42,8 +42,22 @@ class HeightMapViewController extends UIViewController { ...@@ -42,8 +42,22 @@ class HeightMapViewController extends UIViewController {
viewDidLoad() { viewDidLoad() {
this.canvas = $("#heightmap").get(); this.canvas = $("#heightmap").get();
this.canvas.width = this.canvas.parentNode.offsetWidth - 16;
this.canvas.height = this.canvas.parentNode.offsetHeight - 18; this.canvas.width = (this.canvas.parentNode.offsetWidth - 16);
this.canvas.height = (this.canvas.parentNode.offsetHeight - 18);
let ratio = 2;
let oldWidth = this.canvas.width;
let oldHeight = this.canvas.height;
this.canvas.width = oldWidth * ratio;
this.canvas.height = oldHeight * ratio;
this.canvas.style.width = oldWidth + 'px';
this.canvas.style.height = oldHeight + 'px';
console.log(this.canvas.parentNode.offsetHeight);
let ctx = this.canvas.getContext("2d"); let ctx = this.canvas.getContext("2d");
...@@ -78,7 +92,7 @@ class HeightMapViewController extends UIViewController { ...@@ -78,7 +92,7 @@ class HeightMapViewController extends UIViewController {
} }
drawHeightMap() { drawHeightMap() {
let ctx = this.canvas.getContext("2d").scale(2,2); let ctx = this.canvas.getContext("2d");
let height = this.canvas.height; let height = this.canvas.height;
this.clear(); this.clear();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment