Restricting move [message #740702] |
Tue, 18 October 2011 20:01 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
I want to impose some restriction to the movement of some shape, eg. allow to move it only vertically. I guessed that preMoveShape() was devised for this kind of thing, but I ended doing something quite dirty:
protected void preMoveShape(IMoveShapeContext context) {
super.preMoveShape(context);
// ... check some condition ....
if(....) {
((MoveShapeContext)context).setX(context.getX() - context.getDeltaX());
((MoveShapeContext)context).setDeltaX(0);
}
}
Of course, it does not feel right to cast the interface. But I don't see other way (apart from trigger another move... which I like less).
[Updated on: Tue, 18 October 2011 20:02] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04042 seconds