调整大小拖动的方法/库 [英] Approaches / libraries for resize dragging

查看:28
本文介绍了调整大小拖动的方法/库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个 WYSISYG 编辑器,它允许用户通过直接操作来移动、调整大小和旋转形状.当形状旋转时,调整大小似乎相当复杂.我让这个用于非旋转形状,但需要一些三角计算来调整旋转形状的大小.注册点总是在矩形的中间,因为这使得旋转更容易.

I'm currently working on a WYSISYG editor that allows the user to move, resize and rotate shapes by directly manipulating them. The resizing seems to be fairly complex when the shape is rotated. I got this working for non-rotated shapes, but it will take some trigonometric calculations to resize shapes that are rotated. The registration point is always is the middle of the rectangle because this makes rotating a lot easier.

在我开始实施之前,我想知道是否有人知道这样做的任何库或示例源代码,或者可以分享一些计算转换的技巧和窍门.

Before I start implementing this, I was wondering if anyone knew of any libraries or sample source code that does this, or could share some tips and tricks to calculate the transformations.

我有以下参数:

  • 旋转(以度为单位)
  • 宽度、高度
  • x, y
  • mouseX、mouseY

我附上了一张我正在尝试完成的屏幕截图,另一张上面画了一些线条,可以让我扣除三角函数计算.十字是光标.

I attached a screenshot of what I'm trying to accomplish and another one that has some lines drawn onto it that should allow me to deduct the trigonometric calculations. The cross is the cursor.

替代文字 http://www.herrodius.com/images/resize.jpg

替代文字 http://www.herrodius.com/images/resize_lines.jpg

推荐答案

我推荐 Transform Manager - http://www.greensock.com/transformmanageras3/

I recommend Transform Manager - http://www.greensock.com/transformmanageras3/

这篇关于调整大小拖动的方法/库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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