Search in sources :

Example 21 with HitInfo

use of y.view.HitInfo in project binnavi by google.

the class CNodeClickedMiddleState method mouseMoved.

@Override
public IMouseStateChange mouseMoved(final MouseEvent event, final AbstractZyGraph<?, ?> graph) {
    final double x = m_graph.getEditMode().translateX(event.getX());
    final double y = m_graph.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = m_graph.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        return CHitNodesTransformer.changeNode(m_factory, event, hitInfo, m_node);
    } else {
        m_factory.createNodeExitState(m_node, event);
        return CHitNodesTransformer.exitNode(m_factory, event, hitInfo, this);
    }
}
Also used : HitInfo(y.view.HitInfo)

Example 22 with HitInfo

use of y.view.HitInfo in project binnavi by google.

the class CNodeClickedRightState method mouseMoved.

@Override
public IMouseStateChange mouseMoved(final MouseEvent event, final AbstractZyGraph<?, ?> graph) {
    final double x = graph.getEditMode().translateX(event.getX());
    final double y = graph.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = graph.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        return CHitNodesTransformer.changeNode(m_factory, event, hitInfo, m_node);
    } else {
        m_factory.createNodeExitState(m_node, event);
        return CHitNodesTransformer.exitNode(m_factory, event, hitInfo, this);
    }
}
Also used : HitInfo(y.view.HitInfo)

Example 23 with HitInfo

use of y.view.HitInfo in project binnavi by google.

the class CNodeDraggedLeftState method mouseReleased.

@Override
public IMouseStateChange mouseReleased(final MouseEvent event, final AbstractZyGraph<?, ?> graph) {
    final double x = m_graph.getEditMode().translateX(event.getX());
    final double y = m_graph.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = m_graph.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        return CHitNodesTransformer.changeNode(m_factory, event, hitInfo, m_node);
    } else {
        m_factory.createNodeExitState(m_node, event);
        return CHitNodesTransformer.exitNode(m_factory, event, hitInfo, this);
    }
}
Also used : HitInfo(y.view.HitInfo)

Example 24 with HitInfo

use of y.view.HitInfo in project binnavi by google.

the class CMousePressedHandler method handleMousePressed.

public static IMouseStateChange handleMousePressed(final CStateFactory<?, ?> factory, final IMouseState defaultState, final AbstractZyGraph<?, ?> graph, final MouseEvent event) {
    final double x = graph.getEditMode().translateX(event.getX());
    final double y = graph.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = graph.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        final Node n = hitInfo.getHitNode();
        if (SwingUtilities.isLeftMouseButton(event) && !event.isAltDown()) {
            return new CStateChange(factory.createNodePressedLeftState(n, event), true);
        } else if (SwingUtilities.isRightMouseButton(event)) {
            return new CStateChange(factory.createNodePressedRightState(n, event), true);
        } else if (SwingUtilities.isMiddleMouseButton(event) || (event.isAltDown() && SwingUtilities.isLeftMouseButton(event))) {
            return new CStateChange(factory.createNodePressedMiddleState(n, event), false);
        } else {
            return new CStateChange(defaultState, true);
        }
    } else if (hitInfo.hasHitNodeLabels()) {
        throw new IllegalStateException("yFiles Labels are not in use...");
    } else if (hitInfo.hasHitEdges()) {
        final Edge edge = hitInfo.getHitEdge();
        if (SwingUtilities.isLeftMouseButton(event)) {
            return new CStateChange(factory.createEdgePressedLeftState(edge, event), true);
        } else if (SwingUtilities.isRightMouseButton(event)) {
            return new CStateChange(factory.createEdgePressedRightState(edge, event), true);
        } else {
            return new CStateChange(defaultState, true);
        }
    } else if (hitInfo.hasHitEdgeLabels()) {
        // {
        return new CStateChange(defaultState, true);
    // }
    } else if (hitInfo.hasHitBends()) {
        final Bend bend = hitInfo.getHitBend();
        if (SwingUtilities.isLeftMouseButton(event)) {
            return new CStateChange(factory.createBendPressedLeftState(bend, event), true);
        } else {
            return new CStateChange(defaultState, true);
        }
    } else if (hitInfo.hasHitPorts()) {
        return new CStateChange(factory.createDefaultState(), true);
    } else {
        if (SwingUtilities.isLeftMouseButton(event)) {
            return new CStateChange(factory.createBackgroundPressedLeftState(event), true);
        } else if (SwingUtilities.isRightMouseButton(event)) {
            return new CStateChange(factory.createBackgroundPressedRightState(event), true);
        }
        return new CStateChange(factory.createDefaultState(), true);
    }
}
Also used : HitInfo(y.view.HitInfo) Bend(y.view.Bend) Node(y.base.Node) CStateChange(com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange) Edge(y.base.Edge)

Example 25 with HitInfo

use of y.view.HitInfo in project binnavi by google.

the class CDefaultState method mouseMoved.

@Override
public IMouseStateChange mouseMoved(final MouseEvent event, final AbstractZyGraph<?, ?> g) {
    final double x = g.getEditMode().translateX(event.getX());
    final double y = g.getEditMode().translateY(event.getY());
    final HitInfo hitInfo = g.getGraph().getHitInfo(x, y);
    if (hitInfo.hasHitNodes()) {
        return CHitNodesTransformer.enterNode(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitEdges()) {
        return CHitEdgesTransformer.enterEdge(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitEdgeLabels()) {
        return CHitEdgeLabelsTransformer.enterEdgeLabel(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitBends()) {
        return CHitBendsTransformer.enterBend(m_factory, event, hitInfo);
    } else if (hitInfo.hasHitPorts()) {
        return new CStateChange(this, true);
    } else {
        return new CStateChange(this, true);
    }
}
Also used : HitInfo(y.view.HitInfo) CStateChange(com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)

Aggregations

HitInfo (y.view.HitInfo)26 CStateChange (com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)13 Edge (y.base.Edge)3 Node (y.base.Node)3 EdgeLabel (y.view.EdgeLabel)3 ZyGraphEdge (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyGraphEdge)2 ZyGraphNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode)2 Bend (y.view.Bend)1 Graph2DView (y.view.Graph2DView)1 HitInfoFactory (y.view.HitInfoFactory)1