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 {
viewDidLoad() {
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");
......@@ -78,7 +92,7 @@ class HeightMapViewController extends UIViewController {
}
drawHeightMap() {
let ctx = this.canvas.getContext("2d").scale(2,2);
let ctx = this.canvas.getContext("2d");
let height = this.canvas.height;
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