画布仅在iPhone上水平显示
我正在为此失去理智...我正在从事一个不错的个人项目,并且我有一个画布,我在上面绘制了一些图表...问题是,即使在iPhone上,帆布都可以正常工作但是,只有当它是水平的...有人对发生的事情有任何想法吗?
HTML是这样的:
<html>
<body>
<canvas></canvas>
</body>
</html>
使用JS使用JS设置了帆布大小:
const canvas = document.querySelector("canvas");
const c = canvas.getContext('2d');
canvas.width = window.innerWidth * canvasScale;
canvas.height = window.innerHeight * canvasScale;
canvas.style.width = window.innerWidth+"px";
canvas.style.height = window.innerHeight+"px";
我是否缺少某些内容?
如果要检查整个代码,该项目将在此处上传:
https://htmlpreview.github.io/?https://github.com/albertosinigaglia/force-graph/blob/blob/main/main/force-graph-optimization.html
I'm losing my mind on this... I'm working on a nice personal project, and I have a canvas on which I paint some graph... How, the issue is that that canvas works everywhere, even on IPhone, but only if it's horizontal... has anybody an Idea on what's going on?
the HTML is something like this:
<html>
<body>
<canvas></canvas>
</body>
</html>
and the canvas size are set using JS with the following script:
const canvas = document.querySelector("canvas");
const c = canvas.getContext('2d');
canvas.width = window.innerWidth * canvasScale;
canvas.height = window.innerHeight * canvasScale;
canvas.style.width = window.innerWidth+"px";
canvas.style.height = window.innerHeight+"px";
am I missing something?
The project is uploaded here if you want to check the whole code:
https://htmlpreview.github.io/?https://github.com/AlbertoSinigaglia/force-graph/blob/main/force-graph-optimization.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论