![]() |
|
|||||||
| Development Help Help for building applications or diagnosing problems with WWJ |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Dec 2007
Posts: 23
![]() |
I am writing a FengGUI layer. In that layer, I consume the mouse event if FengGUI processes the event. However - in the mouseDragged method in AWTInputHandler - the event is not checked to see if it is consumed before setting isDragging to true. What happens is that in FengGUI, sometimes the mouse gets a little ahead of the thing being dragged, and since the AWTInputHandler thinks that dragging is enabled, the globe rotates.
I think that if the event is consumed by another listener - there should be no chance that dragging is enabled. Right now I don't see a workaround other than subclassing the AWTInputHandler and fixing this problem. Code:
public void mouseDragged(MouseEvent mouseEvent)
{
if (this.wwd == null) // include this test to ensure any derived implementation performs it
return;
if (mouseEvent == null)
return;
Point prevMousePoint = this.mousePoint;
this.mousePoint = mouseEvent.getPoint();
this.callMouseDraggedListeners(mouseEvent);
if (MouseEvent.BUTTON1_DOWN_MASK == mouseEvent.getModifiersEx())
{
PickedObjectList pickedObjects = this.objectsAtButtonPress;
if (this.isDragging
|| (pickedObjects != null && pickedObjects.getTopPickedObject() != null
&& !pickedObjects.getTopPickedObject().isTerrain()))
{
this.isDragging = true;
this.callSelectListeners(new DragSelectEvent(this.wwd, SelectEvent.DRAG, mouseEvent, pickedObjects,
prevMousePoint));
}
}
if (!this.isDragging)
{
if (!mouseEvent.isConsumed())
{
this.viewInputBroker.mouseDragged(mouseEvent);
}
}
// Redraw to update the current position and selection.
if (this.wwd.getSceneController() != null)
{
this.wwd.getSceneController().setPickPoint(mouseEvent.getPoint());
this.wwd.redraw();
}
}
|
|
|
|
|
|
#2 |
|
Junior Member
Join Date: Dec 2007
Posts: 23
![]() |
Hm, maybe this is not a bug. Looks like FengGUI is not processing the drag event. I might have a workaround.
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Dec 2007
Posts: 23
![]() |
Yep - found a simple workaround. No bug in WW.
|
|
|
|
|
|
#4 |
|
WWJ Consultant
Join Date: Jun 2005
Location: Saint-Paul de Vence, Alpes Maritimes, France
Posts: 3,412
![]() |
Can you explain a bit, it may help others...
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Dec 2007
Posts: 23
![]() |
It was totally my mistake. What I ended up doing was setting a flag in the fenggui event handler when a mouse drag started, and then consuming the event if that flag was set. That way if you *start* a drag in fenggui, then it will be in effect until you stop dragging in fenggui.
I am planning to post the FengGUI layer to this forum once it is done (should be this weekend). Is there a better place to put the code? The wiki maybe? |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exception - WWJava - AWTInputHandler | AlexBowen | Development Help | 8 | 03-20-2009 04:44 AM |
| setInputHandler has a bit of a bug. | mharris | Development Help | 2 | 02-01-2008 05:48 PM |
| WWJ bug at high pitch angles near terrain | emaronchi | Development Help | 16 | 11-14-2007 07:56 PM |
| Thread bug? Hang and error message | rogene | Development Help | 6 | 10-09-2007 08:14 AM |
| bug : VE plugin on WW SVN | jp09 | Add-on & Script Development | 2 | 02-28-2007 03:26 AM |