This pans so that the cursor is over the center of the
        current pixel.
769926
def kp_pan_px_center(self, viewer, event, data_x, data_y, msg=True):
        """"""
        if not self.canpan:
            return False
        self.pan_center_px(viewer)
        return True
1010479
def get_mouse_pos(self, window_pos=None):
    """"""
    window_pos = window_pos or pygame.mouse.get_pos()
    # +0.5 to center the point on the middle of the pixel.
    window_pt = point.Point(*window_pos) + 0.5
    for surf in reversed(self._surfaces):
      if (surf.surf_type != SurfType.CHROME and
          surf.surf_rect.contains_point(window_pt)):
        surf_rel_pt = window_pt - surf.surf_rect.tl
        world_pt = surf.world_to_surf.back_pt(surf_rel_pt)
        return MousePos(world_pt, surf)
966877
def set_cursor(self, col, row):
        """"""
        # Clamp row to the last row of the display.
        if row > self._lines:
            row = self._lines - 1
        # Set location.
        self.write8(LCD_SETDDRAMADDR | (col + LCD_ROW_OFFSETS[row]))
1262986
function(feature, pixel) {
                if(feature === control.box) {
                    control.transformFeature({center: control.center});
                }
            }
180275
def center_visible_line(self, before_scroll_offset=False,
                            after_scroll_offset=False):
        
        return (self.first_visible_line(after_scroll_offset) +
                (self.last_visible_line(before_scroll_offset) -
                 self.first_visible_line(after_scroll_offset)) // 2
               )
3021
def center_on(self, item):
        
        if not isinstance(item, GraphicsItem):
            item = coerce_point(item)
        self.proxy.center_on(item)
388972
def center_middle(r, window_size):
  
  res = copy.copy(r)
  mid = res.start + (len(res) / 2)
  res.start = mid - (window_size / 2)
  res.end = res.start + window_size
  return res
1064825
function(evt) {
        var pxCenter = this.rectPxBounds.getCenterPixel();
        var deltaX = evt.xy.x - pxCenter.x;
        var deltaY = evt.xy.y - pxCenter.y;
        var top = this.rectPxBounds.top;
        var left = this.rectPxBounds.left;
        var height = Math.abs(this.rectPxBounds.getHeight());
        var width = this.rectPxBounds.getWidth();
        var newTop = Math.max(0, (top + deltaY));
        newTop = Math.min(newTop, this.ovmap.size.h - height);
        var newLeft = Math.max(0, (left + deltaX));
        newLeft = Math.min(newLeft, this.ovmap.size.w - width);
        this.setRectPxBounds(new OpenLayers.Bounds(newLeft,
                                                   newTop + height,
                                                   newLeft + width,
                                                   newTop));
        this.updateMapToRect();
    }
376217
def place_center(window, width=None, height=None):
    """"""
    screenGeometry = QApplication.desktop().screenGeometry()

    w, h = window.width(), window.height()

    if width is not None or height is not None:
        w = width if width is not None else w
        h = height if height is not None else h
        window.setGeometry(0, 0, w, h)

    x = (screenGeometry.width() - w) / 2
    y = (screenGeometry.height() - h) / 2
    window.move(x, y)
1291592
@Override
	public void onMouseMove(MouseMoveEvent event) {
		if (dragging) {
			Coordinate current = getScreenPosition(event);
			getOverviewMap().movePov(current.getX() - previous.getX(), current.getY() - previous.getY());
			previous = current;
		}
	}
873591
def prev_cursor_location(self):
        
        self._verify_entrypoint_selected()
        self.current_trace_frame_index = max(self.current_trace_frame_index - 1, 0)
        self.trace()
350356
def _restore_cursor(self):
        

        if len(self.cursor_save_stack):
            self.x, self.y = self.cursor_save_stack.pop()
165337
def cursor(self, pos):
        
        index = self.splitAt(pos)

        if len(self._rects[index[0]])-1 < index[1]:
            if index[1] == 0:
                # empty row
                x = 0
            else:
                rect = self._rects[index[0]][index[1]-1]
                x = rect.x() + rect.width()
        else:
            rect = self._rects[index[0]][index[1]]
            x = rect.x()

        y0 = index[0]*(ROW_HEIGHT + ROW_SPACE) + ROW_SPACE
        y1 = y0 + ROW_HEIGHT

        # adjust for scrolled viewport
        x -= self.horizontalScrollBar().value()
        y0 -= self.verticalScrollBar().value()
        y1 -= self.verticalScrollBar().value()
        
        return QtCore.QLine(x,y0,x,y1)
559642
def move(self, x, y):
        
        self._cursor = self._normalizePoint(x, y)
1282113
function(options) {
        this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoom.X,
                                             OpenLayers.Control.PanZoom.Y);
        OpenLayers.Control.prototype.initialize.apply(this, arguments);
    }
878188
function (win, fromPoint, toPoint, duration, callback) {
		if(syn.support.pointerEvents){
			createEventAtPoint("pointerover", fromPoint, win);
			createEventAtPoint("pointerenter", fromPoint, win);
		}
		createEventAtPoint("mouseover", fromPoint, win);
		createEventAtPoint("mouseenter", fromPoint, win);

		if(syn.support.pointerEvents){ createEventAtPoint("pointermove", fromPoint, win); }
		createEventAtPoint("mousemove", fromPoint, win);
		
		
		if(syn.support.pointerEvents){createEventAtPoint("pointerdown", fromPoint, win);}
		if(syn.support.touchEvents){createEventAtPoint("touchstart", fromPoint, win);}
		createEventAtPoint("mousedown", fromPoint, win);
		startMove(win, fromPoint, toPoint, duration, function () {
			if(syn.support.pointerEvents){createEventAtPoint("pointerup", toPoint, win);}
			if(syn.support.touchEvents){createEventAtPoint("touchend", toPoint, win);}
			createEventAtPoint("mouseup", toPoint, win);
			if(syn.support.pointerEvents){createEventAtPoint("pointerleave", toPoint, win);}
			createEventAtPoint("mouseleave", toPoint, win);
			callback();
		});
	}
648795
def center_text_cursor(object):
    

    @functools.wraps(object)
    def center_text_cursor_wrapper(*args, **kwargs):
        """
        Centers the text cursor position.

        :param \*args: Arguments.
        :type \*args: \*
        :param \*\*kwargs: Keywords arguments.
        :type \*\*kwargs: \*\*
        :return: Object.
        :rtype: object
        """

        if args:
            if hasattr(foundations.common.get_first_item(args), "setCenterOnScroll"):
                foundations.common.get_first_item(args).setCenterOnScroll(True)

        value = object(*args, **kwargs)

        if args:
            if hasattr(foundations.common.get_first_item(args), "setCenterOnScroll"):
                foundations.common.get_first_item(args).setCenterOnScroll(False)

        return value

    return center_text_cursor_wrapper