
net.vectorpublish.desktop.vp.api.ui.MouseParticipant Maven / Gradle / Ivy
/*
* Copyright (c) 2016, Peter Rader. All rights reserved.
* ___ ___ __ ______ __ __ __ __
* | | |.-----..----.| |_ .-----..----.| __ \.--.--.| |--.| ||__|.-----.| |--.
* | | || -__|| __|| _|| _ || _|| __/| | || _ || || ||__ --|| |
* \_____/ |_____||____||____||_____||__| |___| |_____||_____||__||__||_____||__|__|
*
* http://www.gnu.org/licenses/gpl-3.0.html
*/
package net.vectorpublish.desktop.vp.api.ui;
import java.awt.Cursor;
import net.vectorpublish.desktop.vp.api.DrawParticipant;
import net.vectorpublish.desktop.vp.api.InheritanceExclusion;
import net.vectorpublish.desktop.vp.api.vpd.DocumentNode;
import net.vectorpublish.desktop.vp.pd.official.DrawPanel;
import net.vectorpublish.desktop.vp.pd.official.RelativeKeyframeRecalculator;
import net.vectorpublish.desktop.vp.pd.official.RelativeRecalculator;
import net.vectorpublish.desktop.vp.pd.official.TechnicalMouseDrag;
/**
* The participant to make basic contributions for the handling.
*
* You may are interrested in {@link DrawParticipant} who makes visual
* contributions to the {@link DrawPanel}.
*/
public abstract interface MouseParticipant extends InheritanceExclusion {
/**
* Informs about the new Position of the mouse-cursor and specify a
* {@link Cursor}.
*
*
* The first two values are ignoring the size and zoom.
*
* The second two values are relative to the document and zoomd. They must
* be float-values because if you have a zoom of 500%, the first pixel of
* the {@link DocumentNode} are technically five pixel in width and five
* pixel in height.
*
*
* Assuming you have the mouse in the middle of the first pixel at 5000%
* zoom, the docRelX has a value of 0.5f
! You may be
* confused because you think if the mouse is on the left side of the zoomed
* first pixel the docRelX must at least be 1
but it
* is between 0
and 0.5f
. That's why
* {@link Math#round(double)} and even {@link Math#floor(double)} wont give
* you the read coordinate.
*
*
* @param markerX
* The technical x-Position of the mousecursor.
* @param markerY
* The technical y-Position of the Mousecursor.
* @param docRelX
* The {@link DocumentNode} relative x-coordinate.
* @param docRelY
* The {@link DocumentNode} realtive y-coordinate.
* @param rel
* The {@link RelativeRecalculator recalculator} for relative
* positions.
* @param pressedLMBSince
* The drag-information if we are dragging, null
if
* we are not dragging.
* @return The {@link Cursor} to use or null
if other
* {@link MouseParticipant} shall specify a {@link Cursor}.
*/
Cursor updateMouse(int markerX, int markerY, float docRelX, float docRelY, RelativeKeyframeRecalculator rel, TechnicalMouseDrag pressedLMBSince);
}