Using the mouse scrollwheel in GLUT

Freeglut’s glutMouseWheelFunc callback is version dependant and not reliable in X. Use standard mouse function and test for buttons 3 and 4. The OpenGlut notes on glutMouseWheelFunc state: Due to lack of information about the mouse, it is impossible to implement this correctly on X at this time. Use of this function limits the portability … Read more

Disable mouse scroll wheel zoom on embedded Google Maps

I was having the same problem: when scrolling the page then the pointer becomes over the map, it starts to zoom in/out the map instead of continuing scrolling the page. 🙁 So I solved this putting a div with an .overlay exactly before each gmap iframe insertion, see: <html> <div class=”overlay” onClick=”style.pointerEvents=”none””></div> <iframe src=”https://mapsengine.google.com/map/embed?mid=some_map_id” width=”640″ … Read more

Zoom Canvas to Mouse Cursor

In short, you want to translate() the canvas context by your offset, scale() it to zoom in or out, and then translate() back by the opposite of the mouse offset. Note that you need to transform the cursor position from screen space into the transformed canvas context. ctx.translate(pt.x,pt.y); ctx.scale(factor,factor); ctx.translate(-pt.x,-pt.y); Demo: http://phrogz.net/tmp/canvas_zoom_to_cursor.html I’ve put up … Read more