@Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { int offs = -1; if (! isAllocationValid()) { Rectangle alloc = a.getBounds(); setSize(alloc.width, alloc.height); } // Get the child view for the line at (x,y), and ask it for the // specific offset. Rectangle alloc = getInsideAllocation(a); View v = getViewAtPoint((int) x, (int) y, alloc); if (v != null) { offs = v.viewToModel(x, y, alloc, bias); // Code folding may have hidden the last line. If so, return the last // visible offset instead of the last offset. if (host.isCodeFoldingEnabled() && v == getView(getViewCount() - 1) && offs == v.getEndOffset() - 1) { offs = host.getLastVisibleOffset(); } } return offs; }
@Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ @Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ @Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ @Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ @Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ @Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { return view.viewToModel(x, y, a, bias); }
/** * Provides a mapping from the view coordinate space to the logical * coordinate space of the model. * * @param x x coordinate of the view location to convert * @param y y coordinate of the view location to convert * @param a the allocated region to render into * @return the location within the model that best represents the * given point in the view */ public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { if (view != null) { int retValue = view.viewToModel(x, y, a, bias); return retValue; } return -1; }
/** * Return the index into the raw text at the specified x and y coordinates * in this node's local coordinate system. * * @param x x coordinate in this node's local coordinate system * @param y y coordinate in this node's local coordinate system * @return the index into the raw text at the specified x and y coordinates * in this node's local coordinate system */ private int pointToModelIndex(final double x, final double y) { final Position.Bias[] biasReturn = new Position.Bias[1]; return htmlView.viewToModel((float) x, (float) y, getBounds(), biasReturn); }
public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { lock(); try { if (view != null) { return view.viewToModel(x, y, a, bias); } return -1; } finally { unlock(); } }
/** * Convert a y-coordinate in the NaviView co-ordinate space to a line number * in the document. */ private int yViewToDocument(int vpos) { View view = editorPane.getUI().getRootView(editorPane); Insets insets = getInsets(); vpos -= insets.top + frw; int myHeight = Math.max(getHeight() - insets.top - insets.bottom - frw*2, 1); if (prefViewHeight > myHeight) { vpos = vpos * prefViewHeight / myHeight; } Bias [] breturn = new Bias[1]; int pos = view.viewToModel(0, vpos, new Rectangle(5,Integer.MAX_VALUE), breturn); return pos; }
public String getLink(Point p){ View view = (View)getClientProperty(BasicHTML.propertyKey); if(view == null) return null; Rectangle textR = ((ZoomableLabelUI)getUI()).getTextR(this); if(textR == null) return null; if(!textR.contains(p)) return null; int x = (int) (p.x / getZoom()); int y = (int) (p.y / getZoom()); final int pos = view.viewToModel(x, y, textR); final HTMLDocument document = (HTMLDocument) view.getDocument(); final String linkURL = HtmlUtils.getURLOfExistingLink(document, pos); return linkURL; }
pos = v.viewToModel(x, y, ca, biasReturn);
return startOffset; int value = v.viewToModel(magicPoint.x, 0f, a, biasRet); return value;
@Override public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) { int offs = -1; if (! isAllocationValid()) { Rectangle alloc = a.getBounds(); setSize(alloc.width, alloc.height); } // Get the child view for the line at (x,y), and ask it for the // specific offset. Rectangle alloc = getInsideAllocation(a); View v = getViewAtPoint((int) x, (int) y, alloc); if (v != null) { offs = v.viewToModel(x, y, alloc, bias); // Code folding may have hidden the last line. If so, return the last // visible offset instead of the last offset. if (host.isCodeFoldingEnabled() && v == getView(getViewCount() - 1) && offs == v.getEndOffset() - 1) { offs = host.getLastVisibleOffset(); } } return offs; }