我正在为 gwtquery 开发一个可旋转的插件。这个想法是为老师创建一个座位表应用程序。只要元素不可拖动,我现在如何让元素旋转。
该插件所做的是附加一个孩子并使孩子可拖动并使用屏幕中的 x 和 y 从中心点获取 atan2 弧度......父母的中心点。如果父母一直在移动,那么中心点不是固定的,因此没有旋转。
我尝试了以下方法来尝试禁用父级,但无济于事
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
};
非常感谢任何帮助