裁剪后的矩形无法按预期工作

发布于 2024-09-14 00:31:03 字数 484 浏览 1 评论 0原文

我有一个 NSView 来绘制一个矩形来裁剪图像,还有一个 NSImageView 来作为网络摄像头(相机预览窗口)。

我想将 NSView 放在 NSImageView 上。

当我拍照时,它可以自动生成裁剪后的图像。

问题是,当我不启动相机预览窗口时,裁剪矩形可以正常拖动和调整大小,但是当我启动相机预览窗口时,裁剪矩形失控。

我已经通过鼠标事件实现了拖动和调整大小功能。

我该如何解决这个问题?

8/19更新:我的代码和程序视频。

代码:gist.github.com/536831

视频:http://www.youtube.com/watch ?v=DLjuBGHh3f8

谢谢!!

I have an NSView to draw a rectangle to crop image, and one NSImageView to be webcam (camera preview window).

I want to put the NSView on the NSImageView.

When I take a picture, it can produce a cropped image automatically.

The problem is that when I don't start the camera preview window, the crop rectangle can drag and resize normally, but when I start the camera preview window, the crop rectangle out of control.

I've implemented drag and resize function by mouse event.

How can I resolve this problem?

8/19 update: My code and program video.

code: gist.github.com/536831

video: http://www.youtube.com/watch?v=DLjuBGHh3f8

Thanks!!

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

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

发布评论

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

评论(1

梦在深巷 2024-09-21 00:31:03

嗯,也许其中一个视图已将“用户交互启用”设置为“否”(例如 UIImageView 的默认值)?

Hmm, maybe one of the views has User Interaction Enabled set to NO (default value for UIImageView, for example)?

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