使用 Konva 进行响应式设计? [英] Responsive Design with Konva?

查看:63
本文介绍了使用 Konva 进行响应式设计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Konva 绘制的图形,是否有可能根据用户使用的设备/分辨率动态缩放?

is it possible that with Konva drawed figures, dynamically scale depending of the device/resolution the user use?

那么,像响应式设计吗?

So, like a responsive design?

谢谢

推荐答案

看看这个 example 使用 KineticJS 制作并尝试根据您的需要进行调整.诀窍是在开始时为舞台设置固定大小,然后根据舞台容器的宽度/高度调整其大小和比例.

Take a look at this example made with KineticJS and try to adapt it according to your needs. The trick is in setting a fixed size for the stage at the begining and then adapt it's size and scale accordingly to the width/height of the stage's container.

您还必须更新一些在 KineticJS 和 Konva.js 之间的转换中可能发生变化的命名约定.

You will also have to update some naming conventions that might have changed in the transition between KineticJS and Konva.js.

这篇关于使用 Konva 进行响应式设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆