如何声明画布以填满整个屏幕?

时间:2019-06-02 17:15:09

标签: javascript html css asp.net web

我有一张地图,在声明的画布上有一点。 我的画布设置为屏幕宽度/高度长,但我的观点被切开了 感觉画布的起点设置为比屏幕顶部低一些。.我该如何更改?

var canvasPoint = document.getElementById("point");
var canvasRout = document.getElementById("rout");

canvasPoint.width = screen.width;
canvasPoint.height = screen.height;
canvasPoint.style.position = "absolute";

canvasRout.width = screen.width;
canvasRout.height = screen.height;
canvasRout.style.position = "absolute";

var ctx = canvasPoint.getContext("2d");
var rout = canvasRout.getContext("2d");

我希望该点位于左上角,但我在图片中的下一点处获得了位置。

0 个答案:

没有答案