QML画布缩放和滚动/平移

时间:2015-11-25 16:17:47

标签: javascript canvas html5-canvas qml

我试图在QML中制作一个画布,您可以在其中滚动/平移和缩放。我对画布的尺寸有麻烦。当我缩小时,画布的尺寸变小,我在右边和底部得到一个没有画布的区域。我已经尝试了很多,似乎没有任何工作。这是一个QML示例:

<a>The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown The quick brown</a>
<a>fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over fox jumps over </a>
<a>the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. the lazy dog. </a>

这就是画布的样子(画布为红色,白色区域无效):

This is what it looks like when you scroll all the way to the right, without zooming. (You can't scroll out of the canvas)

This is what it looks like when you zoom out one step, and scroll to the right. (The scroll bar is too long and you can scroll out)

0 个答案:

没有答案