矩阵帮助:postScale 如何影响矩阵的平移部分?

发布于 2024-09-13 06:26:24 字数 333 浏览 3 评论 0原文

我一直在尝试实施限制,以防止用户在我的多点触控缩放应用程序中过度缩放图像。问题是,当我通过转储矩阵设置最大缩放级别时,一旦图像的整体比例达到我的极限,图像就开始向下平移。我相信这样做是因为矩阵仍然受到 postScale(theScaleFactorX,theScaleFactorY,myMidpointX,myMidpointY) 的影响,其中 theScaleFactorX/Y 是乘以图像整体比例的量(因此,如果 theScaleFatorX/Y 记录为 1.12 ,并且图像为其原始尺寸的 0.60,整体缩放现在为 0.67)。似乎正在进行某种数学运算来创建此翻译,并且想知道是否有人知道它是什么,这样我就可以阻止它翻译,并且只允许用户缩小。

Ive been trying to implement a limit to prevent the user from scaling the image too much in my multitouch zoom app. Problem is, when i set the max zoom level by dumping the matrix, the image starts to translate downward once the overall scale of the image hits my limit. I believe it is doing this because the matrix is still being affected by postScale(theScaleFactorX,theScaleFactorY,myMidpointX,myMidpointY) where theScaleFactorX/Y is the amount to multiply the overall scale of the image (so if the theScaleFatorX/Y is recorded as 1.12, and the image is at .60 of its origional size, the overall zoom is now .67). It seems like some sort of math is going on thats creating this translation, and was wondering if anyone knew what it was so i can prevent it from translating, and only allow the user to zoom back out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小矜持 2024-09-20 06:26:24

仍然不确定 postScale 如何影响翻译,但我通过 if 语句修复了它,说只要我们在我设置的缩放限制内,后缩放就正常。否则,将设置的缩放限制除以 ACTION_DOWN 上记录的保存的全局缩放级别并设置比例,以便将图像保持在正确的缩放级别

Still unsure how postScale affects translation, but I fixed it by having an if statement saying as long as we are within the zoom limit i set, post scale as normal. Otherwise, divide the set zoom limit by the saved global zoom level recorded on ACTION_DOWN and set the scale so it will keep the image at the proper zoom level

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文