当前位置: 首页>>代码示例>>Java>>正文


Java ScrollEvent.getDeltaY方法代码示例

本文整理汇总了Java中javafx.scene.input.ScrollEvent.getDeltaY方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollEvent.getDeltaY方法的具体用法?Java ScrollEvent.getDeltaY怎么用?Java ScrollEvent.getDeltaY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.input.ScrollEvent的用法示例。


在下文中一共展示了ScrollEvent.getDeltaY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleZoomable

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (canvas.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (canvas.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:32,代码来源:ScrollHandlerFX.java

示例2: handle

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
 * Zooms the canvas to the mouse pointer
 * @param event
 */
@Override
public void handle(ScrollEvent event) {
    double delta = 1.2;
    double scale = canvas.getScale(); // currently we only use Y, same value is used for X
    double oldScale = scale;

    if (event.getDeltaY() < 0) {
        scale /= delta;
    } else {
        scale *= delta;
    }
    scale = clamp(scale, MIN_SCALE, MAX_SCALE);

    double f = (scale / oldScale) - 1;
    double dx = (event.getSceneX() - (canvas.getBoundsInParent().getWidth() / 2 + canvas.getBoundsInParent().getMinX()));
    double dy = (event.getSceneY() - (canvas.getBoundsInParent().getHeight() / 2 + canvas.getBoundsInParent().getMinY()));

    canvas.setScale(scale);
    canvas.setPivot(f * dx, f * dy);
    canvas.setTranslateX(clamp(canvas.getTranslateX(), minX(), maxX()));
    canvas.setTranslateY(clamp(canvas.getTranslateX(), minY(), maxY()));

    event.consume();
}
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:29,代码来源:SceneGestures.java

示例3: processScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
 * The process of scrolling value.
 */
private void processScroll(@NotNull final ScrollEvent event) {
    if (!event.isControlDown()) return;

    final TextField source = (TextField) event.getSource();
    final String text = source.getText();

    float value;
    try {
        value = parseFloat(text);
    } catch (final NumberFormatException e) {
        return;
    }

    long longValue = (long) (value * 1000);
    longValue += event.getDeltaY() * 1;

    final String result = String.valueOf(max(min(longValue / 1000F, 1F), 0F));
    source.setText(result);
    source.positionCaret(result.length());

    processChange((KeyEvent) null);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:AlphaInterpolationElement.java

示例4: handleZoomable

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:32,代码来源:ScrollHandlerFX.java

示例5: handleScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
protected void handleScroll(ScrollEvent ev)
{
	if(ev.isShiftDown())
	{
		// TODO horizontal scroll perhaps?
		D.print("horizontal scroll", ev.getDeltaX());
	}
	else if(ev.isShortcutDown())
	{
		// page up / page down
		if(ev.getDeltaY() >= 0)
		{
			editor.pageUp();
		}
		else
		{
			editor.pageDown();
		}
	}
	else
	{
		// vertical block scroll
		editor.blockScroll(ev.getDeltaY() >= 0);
	}
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:26,代码来源:FxEditorMouseHandler.java

示例6: handle

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void handle(ScrollEvent event) {
	event.consume();

	double deltaY = event.getDeltaY();
	double deltaX = event.getDeltaX();

	if (deltaY < 0) {
		scrollPane.setHvalue(Math.min(1, scrollPane.getHvalue() + 0.0007));
	} else if (deltaY > 0) {
		scrollPane.setHvalue(Math.max(0, scrollPane.getHvalue() - 0.0007));
	}
	if (deltaX < 0) {
		scrollPane.setVvalue(Math.min(1, scrollPane.getVvalue() + 0.05));
	} else if (deltaX > 0) {
		scrollPane.setVvalue(Math.max(0, scrollPane.getVvalue() - 0.05));
	}
	
}
 
开发者ID:ProgrammingLife2016,项目名称:PL3-2016,代码行数:20,代码来源:AnnotationController.java

示例7: mouseWheelMoved

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
public void mouseWheelMoved(ScrollEvent e) {

		double scaledDeltaY = e.getDeltaY() > 0 ? -1 : 1;
		double formerZoom = zoom;
		zoom -= scaledDeltaY;
		zoom = zoom <= 1 ? 1 : zoom;

		double deltaX = deltaStart.getX() - delta.getX();
		double deltaY = deltaStart.getY() - delta.getY();

		double projX = (e.getX() + deltaX) / (formerZoom * zoomFactor);
		double projY = (e.getY() + deltaY) / (formerZoom * zoomFactor);

		double newPointX = (projX * zoom * zoomFactor) - deltaX;
		double newPointY = (projY * zoom * zoomFactor) - deltaY;

		setDeltaStart(new Point((int) newPointX, (int) newPointY));
		delta = new Point((int) e.getX(), (int) e.getY());
	}
 
开发者ID:MayerTh,项目名称:RVRPSimulator,代码行数:20,代码来源:TransformationManager.java

示例8: wheelZoom

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/** Zoom in/out triggered by mouse wheel
 *  @param event Scroll event
 */
protected void wheelZoom(final ScrollEvent event)
{
    // Invoked by mouse scroll wheel.
    // Only allow zoom (with control), not pan.
    if (! event.isControlDown())
        return;

    if (event.getDeltaY() > 0)
        zoomInOut(event.getX(), event.getY(), 1.0/ZOOM_FACTOR);
    else if (event.getDeltaY() < 0)
        zoomInOut(event.getX(), event.getY(), ZOOM_FACTOR);
    else
        return;
    event.consume();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:19,代码来源:PlotCanvasBase.java

示例9: processScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
/**
 * The process of scrolling.
 */
@FXThread
private void processScroll(@NotNull final Spinner<Double> spinner, @NotNull final ScrollEvent event) {
    if (!event.isControlDown()) return;

    final double deltaY = event.getDeltaY();

    if (deltaY > 0) {
        spinner.increment(1);
    } else {
        spinner.decrement(1);
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:16,代码来源:SettingsDialog.java

示例10: handleScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
protected void handleScroll(ScrollEvent ev)
{
	if(isOverScrollBar(ev.getX(), ev.getY()))
	{
		return;
	}
	
	if(ev.isShiftDown())
	{
		// TODO horizontal scroll perhaps?
		D.print("horizontal scroll", ev.getDeltaX());
	}
	else if(ev.isShortcutDown())
	{
		// page up / page down
		if(ev.getDeltaY() >= 0)
		{
			editor.pageUp();
		}
		else
		{
			editor.pageDown();
		}
	}
	else
	{
		// vertical block scroll
		editor.blockScroll(ev.getDeltaY() >= 0);
	}
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:31,代码来源:FxEditorMouseController.java

示例11: onMouseScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void onMouseScroll(ScrollEvent e) {
	if (e.getDeltaY() > 0) {
		RendererPlatform.enqueue(app -> setAction(app, ActionType.ScrollIn));
	} else {
		RendererPlatform.enqueue(app -> setAction(app, ActionType.ScrollOut));
	}
}
 
开发者ID:meltzow,项目名称:supernovae,代码行数:9,代码来源:GameInputListener.java

示例12: calculateScale

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
private double calculateScale(ScrollEvent scrollEvent) {
    double scale = m_root.getScaleX() + scrollEvent.getDeltaY() / 500;

    if (scale <= MIN_SCALE) {
        scale = MIN_SCALE;
    } else if (scale >= MAX_SCALE) {
        scale = MAX_SCALE;
    }
    return scale;
}
 
开发者ID:quiram,项目名称:build-hotspots,代码行数:11,代码来源:BuildHotspotsApplicationBase.java

示例13: calculateScale

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
private double calculateScale(ScrollEvent scrollEvent) {
	double scale = nodeToZoom.getScaleX() + scrollEvent.getDeltaY() / 300;

	if (scale <= 0.75) {
		scale = 0.75;
	} else if (scale >= 3) {
		scale = 3;
	}
	return scale;
}
 
开发者ID:bdh92123,项目名称:share_all,代码行数:11,代码来源:RoomController.java

示例14: handleMouseScroll

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
@Override
public void handleMouseScroll(ScrollEvent event) {
	// Get the current z position and modify it by the amount of
	// scrolling
	double z = camera.getTranslateZ();
	double newZ = z + event.getDeltaY();
	camera.setTranslateZ(newZ);
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:9,代码来源:FPSCameraController.java

示例15: handleUserScrolled

import javafx.scene.input.ScrollEvent; //导入方法依赖的package包/类
private void handleUserScrolled(ScrollEvent scrollEvent) {

        // If the user scrolled downwards, we don't want to disable auto-scroll,
        // so check and return if so.
        if (scrollState.get() == ScrollState.SMART_SCROLL || scrollEvent.getDeltaY() <= 0)
            return;

        logger.debug("User has scrolled upwards while in SCROLL_TO_BOTTOM mode, disabling SCROLL_TO_BOTTOM...");

        // Since the user has now scrolled upwards (manually), disable the
        // auto-scroll
        scrollState.set(ScrollState.SMART_SCROLL);
    }
 
开发者ID:mbedded-ninja,项目名称:NinjaTerm,代码行数:14,代码来源:ComDataPane.java


注:本文中的javafx.scene.input.ScrollEvent.getDeltaY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。