本文整理了Java中org.netbeans.api.visual.widget.Widget.isHitAt()
方法的一些代码示例,展示了Widget.isHitAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Widget.isHitAt()
方法的具体详情如下:
包路径:org.netbeans.api.visual.widget.Widget
类名称:Widget
方法名:isHitAt
[英]Called to whether a particular location in local coordination system is controlled (otionally also painted) by the widget.
[中]调用以确定本地协调系统中的特定位置是否由该小部件控制(或者也被绘制)。
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
/**
* Checks whether a specified local location is a part of a widget based on the zoom factor.
* @param localLocation the local location
* @return true, it it is
*/
public boolean isHitAt(Point localLocation) {
double zoom = getScene().getZoomFactor();
if (zoom < hardMinimalZoom || zoom > hardMaximalZoom)
return false;
return super.isHitAt(localLocation);
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
/**
* Checks whether a specified local location is a part of a widget based on the zoom factor.
* @param localLocation the local location
* @return true, it it is
*/
public boolean isHitAt(Point localLocation) {
double zoom = getScene().getZoomFactor();
if (zoom < hardMinimalZoom || zoom > hardMaximalZoom)
return false;
return super.isHitAt(localLocation);
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
/**
* Returns whether a specified local location is a part of the connection widget. It checks whether the location is
* close to the control-points-based path (up to 4px from the line),
* close to the anchors (defined by AnchorShape) or
* close to the control points (PointShape).
* @param localLocation the local locaytion
* @return true, if the location is a part of the connection widget
*/
public boolean isHitAt (Point localLocation) {
if (! super.isHitAt (localLocation))
return false;
List<Point> controlPoints = getControlPoints ();
for (int i = 0; i < controlPoints.size () - 1; i++) {
Point point1 = controlPoints.get (i);
Point point2 = controlPoints.get (i + 1);
double dist = Line2D.ptSegDistSq (point1.x, point1.y, point2.x, point2.y, localLocation.x, localLocation.y);
if (dist < HIT_DISTANCE_SQUARE)
return true;
}
return getControlPointHitAt (localLocation) >= 0;
}
代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-visual
private boolean isHit (final @Nonnull Point point, final @Nonnull Widget widget)
{
// First check children, widget at last
for (final Widget child : widget.getChildren())
{
if (isHit(point, child))
{
return true;
}
}
if (!(widget instanceof Scene) && widget.isHitAt(widget.convertSceneToLocal(point)))
{
return true;
}
return false;
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
/**
* Returns whether a specified local location is a part of the connection widget. It checks whether the location is
* close to the control-points-based path (up to 4px from the line),
* close to the anchors (defined by AnchorShape) or
* close to the control points (PointShape).
* @param localLocation the local locaytion
* @return true, if the location is a part of the connection widget
*/
public boolean isHitAt (Point localLocation) {
if (! super.isHitAt (localLocation))
return false;
List<Point> controlPoints = getControlPoints ();
for (int i = 0; i < controlPoints.size () - 1; i++) {
Point point1 = controlPoints.get (i);
Point point2 = controlPoints.get (i + 1);
double dist = Line2D.ptSegDistSq (point1.x, point1.y, point2.x, point2.y, localLocation.x, localLocation.y);
if (dist < HIT_DISTANCE_SQUARE)
return true;
}
return getControlPointHitAt (localLocation) >= 0;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
private boolean resolveReplacementWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
if (widget == connectionWidget)
return false;
Point widgetLocation = widget.getLocation ();
Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);
if (! widget.getBounds ().contains (location))
return false;
java.util.List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
if (resolveReplacementWidgetCoreDive (result, children.get (i), location))
return true;
}
if (! widget.isHitAt (location))
return false;
ConnectorState state = provider.isReplacementWidget (connectionWidget, widget, reconnectingSource);
if (state == ConnectorState.REJECT)
return false;
if (state == ConnectorState.ACCEPT)
result[0] = widget;
return true;
}
代码示例来源:origin: eu.limetri.client/mapviewer-nb-swing
/**
* Recursive method checking if a layerObject is clicked
*/
private boolean isLayerObjectHit(final Point point, final Widget widget) {
if ((widget instanceof GeometricalWidget) && widget.isHitAt(widget.convertSceneToLocal(point))) {
return true;
}
for (final Widget child : widget.getChildren()) {
if (isLayerObjectHit(point, child)) {
return true;
}
}
return false;
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
private boolean resolveReplacementWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
if (widget == connectionWidget)
return false;
Point widgetLocation = widget.getLocation ();
Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);
if (! widget.getBounds ().contains (location))
return false;
java.util.List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
if (resolveReplacementWidgetCoreDive (result, children.get (i), location))
return true;
}
if (! widget.isHitAt (location))
return false;
ConnectorState state = provider.isReplacementWidget (connectionWidget, widget, reconnectingSource);
if (state == ConnectorState.REJECT)
return false;
if (state == ConnectorState.ACCEPT)
result[0] = widget;
return true;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
private boolean resolveTargetWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
if (interractionLayer.equals (widget))
return false;
Point widgetLocation = widget.getLocation ();
Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);
if (! widget.getBounds ().contains (location))
return false;
java.util.List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
if (resolveTargetWidgetCoreDive (result, children.get (i), location))
return true;
}
if (! widget.isHitAt (location))
return false;
ConnectorState state = provider.isTargetWidget (sourceWidget, widget);
if (state == ConnectorState.REJECT)
return false;
if (state == ConnectorState.ACCEPT)
result[0] = widget;
return true;
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
private boolean resolveTargetWidgetCoreDive (Widget[] result, Widget widget, Point parentLocation) {
if (interractionLayer.equals (widget))
return false;
Point widgetLocation = widget.getLocation ();
Point location = new Point (parentLocation.x - widgetLocation.x, parentLocation.y - widgetLocation.y);
if (! widget.getBounds ().contains (location))
return false;
java.util.List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
if (resolveTargetWidgetCoreDive (result, children.get (i), location))
return true;
}
if (! widget.isHitAt (location))
return false;
ConnectorState state = provider.isTargetWidget (sourceWidget, widget);
if (state == ConnectorState.REJECT)
return false;
if (state == ConnectorState.ACCEPT)
result[0] = widget;
return true;
}
代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap
/**
* Returns true when the event occured on a widget.
*
* @param point Point from where the event was occured
* @param widget Widget to check
* @return
*/
private boolean isHit(final Point point, final Widget widget) {
for (final Widget child : widget.getChildren()) {
if (isHit(point, child)) {
return true;
}
}
if (!(widget instanceof Scene) && widget.isHitAt(widget.convertSceneToLocal(point))) {
return true;
}
return false;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
private boolean resolveContext (Widget widget, Point point, MouseContext context) {
// Point location = widget.getLocation ();
// point.translate (- location.x, - location.y);
if (widget.getBounds ().contains (point)) {
List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
Widget child = children.get (i);
Point location = child.getLocation ();
point.translate (- location.x, - location.y);
boolean resolved = resolveContext (child, point, context);
point.translate (location.x, location.y);
if (resolved)
return true;
}
if (widget.isHitAt (point))
context.update (widget, point);
}
// point.translate (location.x, location.y);
return false;
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
private boolean resolveContext (Widget widget, Point point, MouseContext context) {
// Point location = widget.getLocation ();
// point.translate (- location.x, - location.y);
if (widget.getBounds ().contains (point)) {
List<Widget> children = widget.getChildren ();
for (int i = children.size () - 1; i >= 0; i --) {
Widget child = children.get (i);
Point location = child.getLocation ();
point.translate (- location.x, - location.y);
boolean resolved = resolveContext (child, point, context);
point.translate (location.x, location.y);
if (resolved)
return true;
}
if (widget.isHitAt (point))
context.update (widget, point);
}
// point.translate (location.x, location.y);
return false;
}
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
private void updateState (Widget widget, Point localLocation) {
if (widget != null && ! widget.isHitAt (localLocation))
widget = null;
if (widget == aimedWidget)
return;
if (aimedWidget != null)
aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (false));
aimedWidget = widget;
if (aimedWidget != null)
aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (true));
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
private void updateState (Widget widget, Point localLocation) {
if (widget != null && ! widget.isHitAt (localLocation))
widget = null;
if (widget == aimedWidget)
return;
if (aimedWidget != null)
aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (false));
aimedWidget = widget;
if (aimedWidget != null)
aimedWidget.setState (aimedWidget.getState ().deriveWidgetAimed (true));
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
if (widget.isHitAt (event.getPoint ())) {
WidgetAction.Chain actions;
actions = widget.getActions ();
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
if (widget.isHitAt (event.getPoint ())) {
WidgetAction.Chain actions;
actions = widget.getActions ();
内容来源于网络,如有侵权,请联系作者删除!