I am working on a rotatable plugin for gwtquery. The idea is to create a seating chart app for teacher. Any how I can now get an element to rotate if as long as its not draggable.
What the plugin does is appends a child and makes the child draggable and uses the x and y from screen to get atan2 radians from a center point ... the parent's center point. If the parent is constantly moving then the ceterpoint isn't fixed and thus no rotation.
I've tried the following to trying and disable the parent but to no avail
private final DragFunction start = new DragFunction(){
@Override
public void f(DragContext context) {
//check to see if parent is draggable
DraggableOptions disable = new DraggableOptions();
disable.setDisabled(true);
$(context.getDraggable()).css($$("background-color:Magenta"));
$(context.getDraggable()).parent().css($$("border: 3px solid Magenta"));
//The parent's border indeed turned magenta
//but the draggable parent was not disable :{
$(context.getDraggable()).parent().as(Draggable).options(disable);
$(document).on("mousemove.rotatable", new Function(){
@Override
public boolean f(Event e){
e.stopPropagation();
e.preventDefault();
mouseCoords = new Point( e.getScreenX(), e.getScreenY());
angle = radToDeg(getAngle(mouseCoords, centerCoords));
rotate(angle);
rotating = true;
return true;
}
});
};// end start
};
Any help at all is greatly appreciated
The question is "why is the parent draggable if you don't need that ?"
If you realy need that the parent is draggable, the best in your case is to add a dragFunction to the parent that are checking the value of a boolean. If this boolean is false, throws a StopDragException to stop the drag of the parent. Set this boolean to false in your start function above. And set back this boolean to true when the child stops to drag.