I'm using gamepad api1 to read controller axis value in a web based game, but found that the gamepad API always applies a certain amount of "deadzone" around the center of each axis, where the value doesn't change even when the gimbal on the controller moves. I understand this is useful for common home use controllers, but this is really undesirable for precision focus controllers. How do you disable this auto applied deadzone in webkit?
Related
I am building a chrome extension that would enable the use of my 3d-mouse (made by 3d connexion) to scroll web pages. The built-in 3d connexion drivers are worthless, and the 3d mouse presents itself as a 2 button, 6 axis gamepad to the OS.
The implementation is currently working using the below method:
function get3DMouseData() {
if (document.hasFocus()) {
var gp = navigator.getGamepads()[0]
// axis 5 controls scroll speed
if (gp.axes[5]) window.scrollBy(0,Math.round(gp.axes[5]*10)*10)
}
}
interval = this.setInterval(get3DMouseData, 50)
It doesn't seem to be the smartest strategy to run get3DMouseData 20 times por second, and an event-based implementation would probably be more efficient.
Is there an event-based methods for the gamepad-api that I can use in the case above?
This implementation does not work properly in certain sites (like gmail). What I am doing wrong?
There is no such events:
Other events:
More discussion needed, on whether to include or exclude axis and
button changed events, and whether to roll them more together
("gamepadchanged"?), separate somewhat ("gamepadaxischanged"?), or
separate by individual axis and button.
Also it is said that proper polling is a best practice:
Best Practice 1: Coordination with requestAnimationFrame() Interactive
applications will typically be using the requestAnimationFrame()
method to drive animation, and will want coordinate animation with
user gamepad input. As such, the gamepad data should be polled as
closely as possible to immediately before the animation callbacks are
executed, and with frequency matching that of the animation. That is,
if the animation callbacks are running at 60Hz, the gamepad inputs
should also be sampled at that rate.
Regarding gmail: I guess that it is due restriction policy set on that site:
This specification defines a policy-controlled feature identified by
the string "gamepad". Its default allowlist is 'self'.
'self'
The feature is allowed in documents in top-level browsing contexts by default, and when allowed, is allowed by default to same-origin domain documents in child browsing contexts, but is disallowed by default in cross-origin documents in child browsing contexts.
https://www.w3.org/TR/gamepad/
Is there a way to show/hide objects on a map based on the zoom level in azure indoor maps module? Honestly, I'm not so sure if this feature even exist yet
Custom styling of indoor maps in Azure Maps is a planned feature.
Note that indoor maps leverage vector tiles for rendering and items that don't appear when zoomed out, are not loaded in the map, so you won't be able to show things that aren't there at this time. There will likely be some configuration for this in the future. Things that do appear today could potentially be hidden although in a bit of a hacky way since this custom styling of indoor maps isn't officially supported yet.
For example, using the building from the indoor maps tutorial, the following sets the zoom level range of the room number labels to 0 - 22.
map.map.setLayerZoomRange("indoor_global_unit_label", 0, 22)
The first value in that function is the id of the rendering layer which I retrieved by running the following code in the console, then moving the mouse over the item I wanted to get the id for:
map.events.add('mousemove', function (e) { console.log(e.shapes[0].layer.id ) })
The second and third parameter of the setLayerZoomRange method is the min and max zoom levels. When that line of code is ran, you will notice the labels appear when zoomed out much longer than usual, however, if you zoom out enough, they disappear since they become no longer available in the vector tiles.
I want create fixed user interface elements like "time remaining until the end of the level".
time remaining element
How should I make it to show it correctly in stereo camera
What you want is called non-diegetic UI and is a bit of an antipattern. The recommended way of doing this is to do a diegetic UI - something that is positioned somewhere in the scene, preferably on something that would make sense in real life - for example a computer screen on a console that is in sight.
Still, if you want something in a forced location, it will work well. To do this you should render it in 3d and rotate/position it so that it's always in front of your camera. For example if you would be using the Unity game engine, you could create this UI element as a world space canvas and parent it to the main camera.
I'm working on a windows app in order to learn how to make them in general, and one issue I'm continuously having is the fact that when I go test it, the controls only take up a portion of the screen because they are sized to fit a smaller screen. How can I make them fit for all screens? If I need to provide screenshots to illustrate this point I can.. using forms this was accomplished via docking, but the apps don't seem to have that same capability.
I assume that by "windows app" you mean a Windows Runtime app, probably in Xaml.
You can get dock-like behavior by using the VerticalAlignment and HorizontalAlignment properties on your FrameworkElement (including Controls). This allows forcing the control to the left, right, top, bottom, or stretching to fill the area it is in.
Combine this with flexible layout controls such as Grids. A top level Grid will fill the screen and can contain rows and columns with relative sizes. This allows the page layout to shrink or grow to cover a fairly wide range of sizes with a single layout.
For larger changes (such as switching between portrait and landscape aspect ratios, or to support a skinny snapped window) you can use VisualStates to either move the controls or to switch between different sets of controls. If the controls are data bound then either set will work automatically with the underlying data.
MSDN has some good documentation on these concepts at Guidelines for supporting multiple screen sizes and Quickstart: Designing apps for different window sizes
Firstly,I use google static map API to get the image to display on html/wml.
And then, I want to get the point's GPS position where user pressed on the image.
Is there some way to get the GPS position if I got the co-ordinates on the image?
The short answer is probably not. You can't be sure exactly what the static map's dimensions are (the server might change the location slightly to fit things better, etc.). If you're just asking for a map by center and zoom then you stand a slightly better chance, but it will still be tricky.
If you're trying to add dynamic behaviour to a static map, have you considered instead the Maps JavaScript API? Finding the coordinates of where a user clicks is trivial there. (Also, you can disable the zooming, panning, controls, etc. if you want so that it still feels like it's static).