Not firing dragend or mouseup when drag event is fired - google-maps-api-3

Getting stucked on dragging marker when releasing mouse button (to end the dragging) if only use
google.maps.event.addListener(Marker1,'drag',function() {Marker1.getPosition()})
but if I use
google.maps.event.addListener(Marker1,'dragend',function() {Marker1.getPosition()})
- all works fine and marker drops when I release the mouse button.
Want to use 'drag' for get dynamic position of marker while it beign dragged - not the result on dragend.
Where am I wrong?

Marker1.getPosition() will give you the final position of your marker. During a drag, you want to use the event's latLng property instead:
google.maps.event.addListener(Marker1,'drag',function(e) {
console.log(e.latLng);
});

Related

Google map javascript on marker setPosition() sometimes marker disappears and reappears on any mouse event on map

marker setPosition() method sometimes marker disappears and reappears on any mouse event on map specially scroll event
I found answer to this use map.panBY(0,0) after re-centering the map on setPosition()

Mouse Listeners in Gluon

I've been trying to use listeners on gluon CharmListView for a while. It didn't work in my project so i decided to try it on the FIFTY STATES app. I added the code below:
charmListView.onMouseClickedProperty().set((MouseEvent event) ->{
Logger.getGlobal().log(Level.INFO, "Pick: {0}", new Object[]{event.getPickResult()});
});
When I launch the application, NO click fires aMOUSE_CLICKED event. When I scroll down slightly such that the a list header cell is fully docked like this,
the CharmListView fires the event only on a click on the top header cell.
INFO: Pick: PickResult [node = VBox#49f31558[styleClass=text-box], point = Point3D [x = 133.0, y = 13.0, z = 0.0], distance = 1067.366530964699
No other click anywhere else on the list fires an event.
I've tried adding the same listener to the normal ListView and a MouseEvent is always fired after a click on any area of the ListView. So now I'm stuck because I cannot set a listener to get a selected item.
The CharmListView control is mainly intended for mobile applications, where you use scroll and swipe gestures. But these gestures trigger mouse clicked or pressed events.
If the list cells contain some event handler to process the latter, the only way scroll works is by consuming them, otherwise whenever you scroll the list, the cell event handler will be processed as well, when you start scrolling.
That's the reason why setOnMouseClicked() doesn't trigger any event if you click on the listView.
For accessing the list view selection model, please refer to this question.

Get mouse position outside Flex Panel

I am creating a Flex Panel, which has an image on it. I have set the "buttonMode" and "useHandCursor" property of the image to true. So, whenever I do a mouse over, the cursor changes into a hand tool. I am able to set the mouse-down, mouse-up, mouse-move events on it. But, I see that the mouse-move events only get triggered when I move the mouse inside my Flex panel. I also want to capture the mouse-move event when user moves the mouse outside the Flex panel.
For eg, when user clicks on the image in Flex panel and then drags the mouse(while mouse down) outside the Flex panel, I want to get the current position of mouse while user is dragging the mouse.
Is there any way to get the mouse position outside the Flex panel??
Thanks!
The solution for this is "Mouse-Move" event only.
I need to do the following:
1. Capture mouse-down event on the image.
2. Register for mouse-move and mouse-up event inside the mouse-down event.
3. Inside the mouse-move event get the position of cursor.
4. Inside the mouse-up event unregister mouse-move event.

In flex, how to trigger mouseevent when the focus is on TextInput?

In flex, I am using the following:
mx:TextInput mouseOver="tester(event)"
It works fine. My pointer goes over the textInput and it calls the function. But when I click inside the textInput to enter some text( focus is on the textInput) and then move the mouse (not taking mouse pointer outside of the boundary of textinput), the mouseover event is not trigerred.
If I use click event, then even if I am entering text ( or the focus is on the textinput) and then click, it will call the function.
How can I call the tester function on mouseover when the focus is on textInput?
The mouseOver event fires when the mouse is moved over the control.
Maybe you want to try the mouseMove event which will fire every time the mouse moves?
Keep in mind that mouseEvents and focusEvents are not inherently related. I would expect the mouseOver event to fire when the mouse rolls over your textInput regardless of whether or not that textInput has the focus.

Flex Event Blocked by Another Object

I am using a box element to add a transparent overlay to a column of buttons. I want to add a click event to the buttons. However, when you click a button the click event is only triggered on the overlaying box. Is there anyway to pass the event to the underlying button or perhaps a better way to display an overlay without blocking the click event?
If you want a DisplayObject (which nearly all visual things subclass in Flex) to be treated as "transparent" to the mouse (i.e. it won't intercept click events), set that object's mouseEnabled property to false.
e.g.
transparentBox.mouseEnabled = false;

Resources