在任何旋转中保持位置

发布于 2024-10-08 22:46:45 字数 185 浏览 0 评论 0原文


我已经在一个图层上做了一些绘图,现在我想在另一图层上绘制相同的东西。所以我存储了用户在第一层上绘制的所有绘图点。然后使用 ConvertPoint: toLayer: 方法将存储的点转换为点另一层。它的工作原理。但是在方向上产生了问题。如果我画过肖像的话。然后它将仅适用于纵向,横向位置将发生变化。所以请建议任何摆脱这种情况的方法。
谢谢

I have done some drawing on one layer now I want to draw same thing on another layer.So I have stored all the points of drawing that user has drawn on first layer.And then using convertPoint: toLayer: method converting stored point into points of another layer. And its working.But creates problem in orientation. If I have done drawing in portrait. Then it will work only for portrait in landscape position will be change. So please suggest any way to get out of this.
Thanks

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

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

发布评论

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

评论(1

ゃ懵逼小萝莉 2024-10-15 22:46:45

标准化存储的点,使 x、y 位置相对于尺寸为 0..1、0..1 的表面(将 x、y 除以当前表面的宽度和高度)。然后,每当您想要更改基础表面的大小时,请将每个点乘以该新表面的宽度和高度。现在,无论表面尺寸如何,所有点都将出现在相同的相对位置。

请注意,上面的内容会缩放(从纵向到横向,Y 将被压缩,X 将被扩展)。如果您不想这样做,则还需要考虑屏幕上表面的物理尺寸。也就是说,将您的点标准化为某个物理维度。

注意:我不知道您正在使用什么系统、语言、软件包、库等,因为您没有在问题中说明!

Normalise your stored points, such that the x, y positions are relative to a surface of size 0..1, 0..1 (divide the x, y by the width and height of the current surface). Then, whenever you want to change the size of the underlying surface, multiply each point by this new surface's width and height. All points will now appear in the same relative positions regardless of the surface dimensions.

Note the above will scale (going from portrait to landscape, the Y will be compressed and the X expanded). If you don't want to do this, you will need to take physical dimensions of the surface on-screen into account too. That is, normalise your points to some physical dimension instead.

Note: I have no idea what system, language, package, library, etc. you are using as you don't state in your question!

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