Click events
            - left click & scroll up/down: switch between rotations
            - right click: apply selected rotation
501449
def on_click(self, event):
        
        button = event["button"]
        if button in [1, 4, 5]:
            self.scrolling = True
            self._switch_selection()
        elif button == 3:
            self._apply()
1232897
def ms_rotate(self, viewer, event, data_x, data_y, msg=True):
        
        if not self.canrotate:
            return True
        msg = self.settings.get('msg_rotate', msg)

        x, y = self.get_win_xy(viewer)

        if event.state == 'move':
            self._rotate_xy(viewer, x, y)

        elif event.state == 'down':
            if msg:
                viewer.onscreen_message("Rotate (drag around center)",
                                        delay=1.0)
            self._start_x, self._start_y = x, y
            self._start_rot = viewer.get_rotation()

        else:
            viewer.onscreen_message(None)
        return True
194281
function(oTable) {
			var oScrollExtension = oTable._getScrollExtension();
			var aEventListenerTargets = ScrollingHelper.getEventListenerTargets(oTable);

			oScrollExtension._mMouseWheelEventListener = this.addMouseWheelEventListener(aEventListenerTargets, oTable, {
				scrollDirection: ScrollDirection.BOTH
			});
			oScrollExtension._mTouchEventListener = this.addTouchEventListener(aEventListenerTargets, oTable, {
				scrollDirection: ScrollDirection.BOTH
			});
		}
1260554
function(e) {
			switch (e.type) {
				case 'click':
				case 'mousedown':
				case 'mouseup':
					this._onmouseevent(e);
					break;
				case 'orientationchange':
					this._onrotate();
					break;
				case 'resize':
					this._onresize();
					break;
				case 'DOMContentLoaded':
					this._ondom();
					/*
					if (!gui.hasModule('gui-spirits@wunderbyte.com')) {
						(function cleanthisup() {
							gui._oninit();
							gui.$onready();
						}());
					}
					*/
					break;
				case 'load':
					this._onload();
					break;
				case 'unload':
					this._onunload();
					break;
				case 'hashchange':
					this._onhashchange();
					break;
			}
		}
646788
function() {
			clearTimeout( panEngageTimeout );
			clearInterval( panUpdateInterval );

			var scrollOffset = getScrollOffset();

			if( currentOptions && currentOptions.element ) {
				scrollOffset.x -= ( window.innerWidth - ( currentOptions.width * currentOptions.scale ) ) / 2;
			}

			magnify( scrollOffset.x, scrollOffset.y, 0, 0, 1 );

			level = 1;
		}
302979
function( start, end, duration, element, callback ) {
			createEventAtPoint("mousedown", start, element);
			startMove(start, end, duration, element, function() {
				createEventAtPoint("mouseup", end, element);
				callback();
			})
		}
885289
function makeScrollEvents($el) {
  if ($el._data._scrollEvents) return;
  $el._data._scrollEvents = true;

  let ticking = false;
  let top = null;

  function tick() {
    let newTop = $el.scrollTop;
    if (newTop == top) { ticking = false; return; }

    top = newTop;
    $el.trigger('scroll', { top });
    // TODO Scroll should trigger mousemove events.
    window.requestAnimationFrame(tick);
  }

  function scroll() {
    if (!ticking) window.requestAnimationFrame(tick);
    ticking = true;
  }

  // Mouse Events
  let target = $el instanceof Elements.WindowElement ? window : $el._el;
  target.addEventListener('scroll', scroll);

  // Touch Events
  function touchStart() {
    window.addEventListener('touchmove', scroll);
    window.addEventListener('touchend', touchEnd);
  }
  function touchEnd() {
    window.removeEventListener('touchmove', scroll);
    window.removeEventListener('touchend', touchEnd);
  }

  $el._el.addEventListener('touchstart', function(e) {
    if (!e.handled) touchStart();
  });
}
1220077
function rotateScreen(r) {
    lcd.setRotation(r);
    lcd.fillRect(0, 0, 5, 5, ili9341.ILI9341_WHITE);
    if (r < 4) {
        r++;
        setTimeout(function() { rotateScreen(r); }, 1000);
    }
}
1275823
function (clickX, clickY, cmenu, e) {
            var x = clickX + cmenu.offsetX;
            var y = clickY + cmenu.offsetY;
            var h = $(cmenu.menu).height();
            var w = $(cmenu.menu).width();
            var dir = cmenu.direction;
            if (cmenu.constrainToScreen) {
                var $w = $(window);
                var wh = $w.height();
                var ww = $w.width();
                var st = $w.scrollTop();
                var maxTop = y - st - 5;
                var maxBottom = wh + st - y - 5;
                if (h > maxBottom) {
                    if (h > maxTop) {
                        if (maxTop > maxBottom) {
                            // scrollable en haut
                            h = maxTop;
                            cmenu._div.css('height', h + 'px').css('overflow-y', 'scroll');
                            y -= h;
                        }
                        else {
                            // scrollable en bas
                            h = maxBottom;
                            cmenu._div.css('height', h + 'px').css('overflow-y', 'scroll');
                        }
                    }
                    else {
                        // menu ok en haut
                        y -= h;
                    }
                }
                else {
                    // menu ok en bas
                }

                var maxRight = x + w - $w.scrollLeft();
                if (maxRight > ww) {
                    x -= (maxRight - ww);
                }
            }
            return {'x': x, 'y': y};
        }
139574
function() {
		this.scrollToCurrent();
		window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
		document.body.addEventListener('click', this.delegateAnchors.bind(this));
	  }
933699
def on_click(self, button, button_state, cursor_x, cursor_y):
        
        self.isdragging = False
        if button == glut.GLUT_LEFT_BUTTON and button_state == glut.GLUT_UP:
            # Left button released
            self.lastrot = copy.copy(self.thisrot)  # Set Last Static Rotation To Last Dynamic One
        elif button == glut.GLUT_LEFT_BUTTON and button_state == glut.GLUT_DOWN:
            # Left button clicked down
            self.lastrot = copy.copy(self.thisrot)  # Set Last Static Rotation To Last Dynamic One
            self.isdragging = True  # Prepare For Dragging
            mouse_pt = arcball.Point2fT(cursor_x, cursor_y)
            self.arcball.click(mouse_pt)  # Update Start Vector And Prepare For Dragging
        elif button == glut.GLUT_RIGHT_BUTTON and button_state == glut.GLUT_DOWN:
            # If a mouse click location was requested, return it to caller
            if hasattr(self, 'event_port'):
                self.mouseclick_port = self.event_port
                del self.event_port
            if hasattr(self, 'mouseclick_port'):
                self.send_mouseclick_to_caller(cursor_x, cursor_y)
        elif button == glut.GLUT_MIDDLE_BUTTON and button_state == glut.GLUT_DOWN:
            # If a mouse click location was requested, return it to caller
            if hasattr(self, 'event_port'):
                self.mouseclick_port = self.event_port
                del self.event_port
            if hasattr(self, 'mouseclick_port'):
                self.send_mouseclick_to_caller(cursor_x, cursor_y, button='middle')
        glut.glutPostRedisplay()
786350
function(event) {
		if (this.hasScroll()) {
			// TODO merge with no-scroll-else
			if (!this.active || this.last()) {
				this.activate(event, this.element.children(".ui-menu-item:first"));
				return;
			}
			var base = this.active.offset().top,
				height = this.element.height(),
				result = this.element.children(".ui-menu-item").filter(function() {
					var close = $(this).offset().top - base - height + $(this).height();
					// TODO improve approximation
					return close < 10 && close > -10;
				});

			// TODO try to catch this earlier when scrollTop indicates the last page anyway
			if (!result.length) {
				result = this.element.children(".ui-menu-item:last");
			}
			this.activate(event, result);
		} else {
			this.activate(event, this.element.children(".ui-menu-item")
				.filter(!this.active || this.last() ? ":first" : ":last"));
		}
	}
375920
function mouseActionLocal(angleXY) {
    rotator.yaw = -angleXY[0];
    rotator.pitch = angleXY[1];
    rotator.updateRotMtx();
}
368131
function(leftScrollElm, rightScrollElm, elmToScroll, scrollSpeed) {
        var scrollSpeed = scrollSpeed ? scrollSpeed : 5;

        leftScrollElm.on('mouseenter', function() {
            var timer = setInterval(function() {
                elmToScroll.scrollLeft(elmToScroll.scrollLeft() - scrollSpeed);
            }, 20);

            leftScrollElm.on('mouseleave', function() {
                clearInterval(timer);
            });
        });
        rightScrollElm.on('mouseenter', function() {
            var timer = setInterval(function() {
                elmToScroll.scrollLeft(elmToScroll.scrollLeft() + scrollSpeed);
            }, 20);

            rightScrollElm.on('mouseleave', function() {
                clearInterval(timer);
            });
        });
    }
653814
def OnMouseWheel(self, event):
        """"""

        # Prevent lost IntCtrl changes
        if self.switching:
            time.sleep(0.1)
            return

        value = self.GetValue()

        current_time = time.clock()
        if current_time < self.last_change_s + 0.01:
            return

        if event.GetWheelRotation() >= event.GetWheelDelta():
            self.SetValue(min(value+1, self.no_tabs-1))
        elif event.GetWheelRotation() <= -event.GetWheelDelta():
            self.SetValue(max(value-1, 0))
480332
function() {
      var self = this;
      self.update();
      return {
        left: self.__scrollLeft,
        top: self.__scrollTop,
        zoom: 1
      };
    }
1188910
function(left, top, animate) {

			var self = this;

			var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;
			var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;

			self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);

		}