In Cesium, how can I auto trigger click event without mouse click? - javascript

I want to make a query function for 3d tile. When i search a tile, the tile's contour will highlight (like 3D Tiles Feature Picking Demo). In Cesium demo, they pick a tile feature by mouse click event, but i don't want to pick a tile feature by mouse click. I want to give pick function a value (for example: viewer.scene.pick(Cesium.Cartesian2(309,306));), then i can get that tile.
In Cesium, how can I auto trigger click event without mouse click when I want to pick a 3d tile feature ? If no, how should I do?

Related

Simulate Google Maps doubleclick

I've created a Google Maps map using vue-google-maps, when the user double clicks on the map it zooms in towards the mouse location.
I would like to turn this into a single mouse click, so when the user clicks somewhere on the map it automatically zooms in.
The best solution I could come up with is to listen for a click event and then simulate a mouse double click with dblclick but this doesn't work
$("#certificate-dashboard-map").click(function() {
$(this).dblclick();
});
How could I simulate a double mouse click that would trigger Google Maps ? Any other solutions would also be welcome ofcourse.
It turns out there is a option to enable single click zoom in vue-google-maps, which can be enabled by adding :zoom-on-click="true" to the map component

Openlayers middle mouse button panning

I'm pretty new to Openlayers and I have a problem with map panning using middle mouse button. Basically, I want to use the middle mouse button only for map panning, so that when other tools are selected/used (as identify feature tool) the middle mouse won't be used for selecting (only left mouse button).
Any suggestion?

How to detect mouseenter/mouseleave event on lots of items without slow-down

I have realy specific question about Canvas handling mouse-events.
I'm working on a isometric game, I have a displayed map with all tiles, and I want know on which one the mouse are.
On a basic isometric map it's easy to transform the position on the screen (blue on the next image) on a map position (orange) with basic affine function (ax+b, with 'a' is width_tile/height_tile and b is the current position of the map view, red line on the image)..
But I have a complication, each tile of the game have a specific elevation (displayed by red arrow on second image). So i can't use a function for each line(y)/column(x) of the map.
On the same technique I'll try to calculate if mouse position are on EACH tile one by one for EACH mouse event (move, click, ..) but I'm afraid for the heavy code : if I have a 100x100 map and I shack the mouse, I'm sure all this test will ruin the client browser..
I realy don't know how can I do it better ?!
Someone have an idea, or a tips to optimize this check ?

Detecting mouse events on drag in EaselJS across shapes

I have a chessboard like UI, wherein when I drag across check squares I need to EaselJS to detect my shapes(different squares) .I have hooked up those shapes with onMouseMove event handler. However I see that which ever shape gets clicked on mouse down that same shapes keeps emitting the onmousemove event even though I have moved outside the surface area of that shape and onto another shape. How can I have events that listen when I move out of the shape and into another shape using drag/touch or mouse drag?
The mousemove events come from the shape you clicked on, so the target will always be that initial clicked shape.
To determine what is currently under the mouse, use the getObjectUnderPoint or getObjectsUnderPoint APIs.
http://www.createjs.com/Docs/EaselJS/classes/Container.html#method_getObjectsUnderPoint

HTML5 canvas painting rectangle on mouse click

I have a canvas which loads in a selected image. The canvas should display 2 6x6 rectangles where the user clicks. On the first click, the rectangle should be red, the second click it should be blue on the third click, it resets (deletes both first rectangles) and so on..
This works fine (see example here: http://jsfiddle.net/8HSGG/)
My problem is when I reload an image, the rectangles start messing up (i.e. colors come in different order or don't show up at all).
I have two variables in the Javascript: topLeft and bottomRight which are both null whenever an image is loaded in, then a check based on those and paint accordingly.
Any idea what's going on?
You're adding click and mouseover event listeners to the canvas every time you're "handling" the image. Thus, I would suspect you're getting code that gets invoked multiple times.

Categories

Resources