开发者

NSImageView and NSUndoManager

I have a image on the view and user can drag and move the image or rotate the image with finger touch.

I want to do Undo the action performed by user.

Like if the image is move to new location and then user press undo button, image should move back to the previous location. Or if user rotates the image and then press undo button it should rotate image to its previous angle.

It would be helpful if I get any sample 开发者_StackOverflow社区example for the same.

Thanks in advance


Check out the Solution that Rob Posted here.

It only deals with one gesture at a time though. If you are dealing strictly with the Transform and the Center (for Pan) then You should be fine with his solution if you do not allow Pan, Rotate, Pinch at the same time. If Pinch Pinch and Rotate at the same time, if working with a Transform you just need to set the transform once at the beginning and deal with who sets it first so the other gesture does not set the Original Transform.

I'm working on a way to encapsulate multiple attributes into a Dictionary to then Undo/Redo, though need a way to copy that Dictionary to the Undo/Redo Stack, see this Question

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜