GraphMouseImpl.java 文件源码

java
阅读 35 收藏 0 点赞 0 评论 0

项目:cuttlefish 作者:
public void mouseWheelMoved(MouseWheelEvent e) {
    double rotation = e.getWheelRotation();
    double sensitivity = 0.05;
    double zx, zy;
    double scaling = zoom > 1 ? 1 : renderer.getScaleFactor();

    zoom += rotation * sensitivity * scaling;
    zoomPos = renderer.screenToWorld(e.getPoint());
    zx = zoomPos.getX() * scaling;
    zy = zoomPos.getY() * scaling;
    zoomPos.setLocation(zx, zy);

    renderer.scale(zoom, zoomPos);
    renderer.repaint();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号