Returns x coordinate of the caret in the current paragraph.
973032
final ParagraphBox.CaretOffsetX getCaretOffsetX(CaretNode caret) {
        return getCell(caret.getParagraphIndex()).getCaretOffsetX(caret);
    }
511111
@Override
    public void selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn) {
        selectRangeExpl(textPosition(anchorParagraph, anchorColumn), textPosition(caretParagraph, caretColumn));
    }
529336
function() {
			// figure out initial offset, it should be the minimum between 
			// the beginning of the selection and the current caret offset
			var offset = this.textView.getCaretOffset();
			var sel = this.textView.getSelection();
			var selectionStart = Math.min(sel.start, sel.end);			
			this._initialCaretOffset = Math.min(offset, selectionStart);
			this._computedProposals = null;
			delete this._autoApply;
			this._computeProposals(this._initialCaretOffset).then(function(proposals) {
				if (this.isActive()) {
					var flatProposalArray = this._flatten(proposals);
					//check if flattened proposals form a valid array with at least one entry
					if (flatProposalArray && Array.isArray(flatProposalArray) && (0 < flatProposalArray.length)) {
						this._computedProposals = proposals;
					}
					var autoApply = typeof this._autoApply === 'boolean' ? this._autoApply : !this._autoTriggerEnabled;
					this.dispatchEvent({type: "ProposalsComputed", data: {proposals: flatProposalArray}, autoApply: autoApply}); //$NON-NLS-0$
					if (this._computedProposals && this._filterText) {
						// force filtering here because user entered text after
						// computeProposals() was called but before the plugins
						// returned the computed proposals
						this.filterProposals(true);
					}
				}
			}.bind(this));
		}
331056
def get_x(self, var, coords=None):
        
        if coords is None:
            coords = self.ds.coords
        # first we try the super class
        ret = super(UGridDecoder, self).get_x(var, coords)
        # but if that doesn't work because we get the variable name in the
        # dimension of `var`, we use the means of the triangles
        if ret is None or ret.name in var.dims:
            bounds = self.get_cell_node_coord(var, axis='x', coords=coords)
            if bounds is not None:
                centers = bounds.mean(axis=-1)
                x = self.get_nodes(self.get_mesh(var, coords), coords)[0]
                try:
                    cls = xr.IndexVariable
                except AttributeError:  # xarray < 0.9
                    cls = xr.Coordinate
                return cls(x.name, centers, attrs=x.attrs.copy())
622420
def static_position(self) -> typing.Tuple[float, float]:
        
        unit = self._section_static['units'][1]
        return unit['x'], unit['y']
162769
def get_word_at(self, coordinates):
        """"""
        cursor = self.cursorForPosition(coordinates)
        cursor.select(QTextCursor.WordUnderCursor)
        return to_text_string(cursor.selectedText())
25689
def get_coordinates(node_class):
    """"""
    quadrant_size = (2 * math.pi / 8.0)
    quadrant = get_quadrant_from_class(node_class)
    begin_angle = quadrant_size * quadrant
    r = 200 + 800*random.random()
    alpha = begin_angle + random.random() * quadrant_size
    x = r * math.cos(alpha)
    y = r * math.sin(alpha)
    return x, y
460517
def get_pos_hint_x(poshints, sizehintx):
    
    if 'x' in poshints:
        return poshints['x']
    elif sizehintx is not None:
        if 'center_x' in poshints:
            return (
                poshints['center_x'] -
                sizehintx / 2
            )
        elif 'right' in poshints:
            return (
                poshints['right'] -
                sizehintx
            )
427844
function getTopEdge(index, row) {
        return {
          index: index,
          y: editor.dom.getPos(row).y
        };
      }
666714
function () {
            if (this._calendarFocus) {
                var currentCaretPosition = this._currentCaretPosition;
                if (currentCaretPosition) {
                    return currentCaretPosition;
                }
                return {
                    start : 0,
                    end : 0
                };
            } else {
                return this.$DropDownTextInput.getCaretPosition.apply(this, arguments);
            }
        }
688920
private int getOrAppendVertex(Coordinate newCoord, Quadtree ptQuad) {
        Envelope queryEnv = new Envelope(newCoord);
        queryEnv.expandBy(epsilon);
        QuadTreeVisitor visitor = new QuadTreeVisitor(epsilon, newCoord);
        try {
            ptQuad.query(queryEnv, visitor);
        } catch (RuntimeException ex) {
            //ignore
        }
        if (visitor.getNearest() != null) {
            return visitor.getNearest().index;
        }
        // Not found then
        // Append to the list and QuadTree
        EnvelopeWithIndex ret = new EnvelopeWithIndex(triVertex.size(), newCoord);
        ptQuad.insert(queryEnv, ret);
        triVertex.add(ret);
        return ret.index;
    }
1267239
function getCursorPosition(event) {
  let cursorX;
  let cursorY;
  let rect = htmlElement.getBoundingClientRect();
  if (event.touches !== undefined) {
    cursorX = event.touches[0].clientX;
    cursorY = event.touches[0].clientY;
  } else {
    cursorX = event.clientX;
    cursorY = event.clientY;
  }
  return {
    x: cursorX - rect.left,
    y: cursorY - rect.top,
  };
}
955709
def get_text_position(fig, ax, ha='left', va='top', pad_scale=1.0):
    """"""
    ## Check and preprocess input arguments
    try: pad_scale = float(pad_scale)
    except: raise TypeError("'pad_scale should be of type 'float'")
        
    for arg in [va, ha]: 
        assert type(arg) is str
        arg = arg.lower() # Make it lowercase to prevent case problem.
    
    ## Get axis size in inches
    ax_height, ax_width = get_ax_size_in_inch(fig, ax)
    
    ## Construct inversion factor from inch to plot coordinate
    length_x = ax.get_xlim()[1] - ax.get_xlim()[0]
    length_y = ax.get_ylim()[1] - ax.get_ylim()[0]
    inch2coord_x = length_x / ax_width
    inch2coord_y = length_y / ax_height
    
    ## Set padding size relative to the text size
    #pad_inch = text_bbox_inch.height * pad_scale
    #pad_inch = fontsize_points * point2inch * pad_scale
    ax_length_geom_average = (ax_height * ax_width) ** 0.5
    pad_inch = ax_length_geom_average * 0.03 * pad_scale
    pad_inch_x, pad_inch_y = pad_inch, pad_inch
    
    pad_coord_x = pad_inch_x * inch2coord_x
    pad_coord_y = pad_inch_y * inch2coord_y
    
    if ha == 'left': pos_x = ax.get_xlim()[0] + pad_coord_x
    elif ha == 'right': pos_x = ax.get_xlim()[1] - pad_coord_x
    else: raise Exception("Unsupported value for 'ha'")
    
    if va in ['top','up','upper']: pos_y = ax.get_ylim()[1] - pad_coord_y
    elif va in ['bottom','down','lower']: pos_y = ax.get_ylim()[0] + pad_coord_y
    else: raise Exception("Unsupported value for 'va'")
    
    return pos_x, pos_y
373990
def _calculate_position(self, at_line=None, at_position=None,
                            at_point=None):
        
        # Check that no option or only one option is given:
        if [at_line, at_position, at_point].count(None) < 2:
            raise Exception('Provide no argument or only one argument!')

        # Saving cursor position:
        if at_position is None:
            at_position = self.get_position('cursor')

        # FIXME: What id this used for?
        self.calltip_position = at_position

        if at_point is not None:
            # Showing tooltip at point position
            cx, cy = at_point.x(), at_point.y()
        elif at_line is not None:
            # Showing tooltip at line
            cx = 5
            cursor = QTextCursor(self.document().findBlockByNumber(at_line-1))
            cy = self.cursorRect(cursor).top()
        else:
            # Showing tooltip at cursor position
            # FIXME: why is at_position not being used to calculate the
            # coordinates?
            cx, cy = self.get_coordinates('cursor')

        # Calculate vertical delta
        font = self.font()
        delta = font.pointSize() + 5

        # Map to global coordinates
        point = self.mapToGlobal(QPoint(cx, cy))
        point = self.calculate_real_position(point)
        point.setY(point.y() + delta)

        return point
979057
function getCarouselItemPosition(pos) {
        var carousel    = this,
            itemsPerRow = carousel._cols,
            itemsPerCol = carousel._rows,
            page,
            sz,
            isVertical,
            itemsCol,
            itemsRow,
            sentinel,
            delta = 0,
            top,
            left,
            rsz,
            styles = {},
            index = 0,
            itemsTable = carousel._itemsTable,
            items = itemsTable.items,
            loading = itemsTable.loading;

        isVertical = carousel.get("isVertical");
        sz  = getCarouselItemSize.call(carousel,
                isVertical ? "height" : "width");
        rsz = getRevealSize.call(carousel);

        // adjust for items not yet loaded
        while (index < pos) {
            if (!items[index] && !loading[index]) {
                delta++;
            }
            index++;
        }
        pos -= delta;

        if (itemsPerCol) {
            page = this.getPageForItem(pos);
            if (isVertical) {
                itemsRow = Math.floor(pos/itemsPerRow);
                delta = itemsRow;
                top = delta * sz;
                styles.top  = (top + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "width");

                itemsCol = pos % itemsPerRow;
                delta = itemsCol;
                left = delta * sz;
                styles.left = left + "px";
            } else {
                itemsCol = pos % itemsPerRow;
                sentinel = (page - 1) * itemsPerRow;
                delta = itemsCol + sentinel;
                left = delta * sz;
                styles.left = (left + rsz) + "px";

                sz  = getCarouselItemSize.call(carousel, "height");

                itemsRow = Math.floor(pos/itemsPerRow);
                sentinel = (page - 1) * itemsPerCol;
                delta = itemsRow - sentinel;
                top = delta * sz;

                styles.top  = top + "px";
            }
        } else {
        if (isVertical) {
            styles.left = 0;
            styles.top  = ((pos * sz) + rsz) + "px";
        } else {
            styles.top  = 0;
            styles.left = ((pos * sz) + rsz) + "px";
        }
        }

        return styles;
    }
227743
def _get_x_axis(self):
        """"""
        # 0,0 is top/left top top/left pixel. Actual x/y coord of that pixel are (.5,.5).
        x_centers = np.linspace(.5, self.x_size - .5, self.x_size)
        y_centers = x_centers * 0
        return (self.geotransform[0]
                + self.geotransform[1] * x_centers
                + self.geotransform[2] * y_centers)
267094
def _highlight_caret_scope(self):
        
        cursor = self.editor.textCursor()
        block_nbr = cursor.blockNumber()
        if self._block_nbr != block_nbr:
            block = FoldScope.find_parent_scope(
                self.editor.textCursor().block())
            try:
                s = FoldScope(block)
            except ValueError:
                self._clear_scope_decos()
            else:
                self._mouse_over_line = block.blockNumber()
                if TextBlockHelper.is_fold_trigger(block):
                    self._highlight_block(block)
        self._block_nbr = block_nbr