下面列出了javafx.scene.input.MouseEvent#isShortcutDown ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/** @param event Mouse event to check for target modifier keys */
private void checkModifiers(final MouseEvent event)
{
// 'control' ('command' on Mac OS X)
if (event.isShortcutDown())
target_modifier = Optional.of(OpenDisplayActionInfo.Target.TAB);
else if (event.isShiftDown())
target_modifier = Optional.of(OpenDisplayActionInfo.Target.WINDOW);
else
target_modifier = Optional.empty();
// At least on Linux, a Control-click or Shift-click
// will not 'arm' the button, so the click is basically ignored.
// Force the 'arm', so user can Control-click or Shift-click to
// invoke the button
if (target_modifier.isPresent())
{
logger.log(Level.FINE, "{0} modifier: {1}", new Object[] { model_widget, target_modifier.get() });
base.arm();
}
}
/**
* Handles mouse-pressed events on the given joint.
*
* @param event a mouse-pressed event
* @param joint the {@link GJoint} on which this event occured
*/
private void handleJointPressed(final MouseEvent event, final GJoint joint) {
if (!event.getButton().equals(MouseButton.PRIMARY)) {
return;
}
final GJointSkin jointSkin = skinLookup.lookupJoint(joint);
if (!jointSkin.isSelected()) {
if (!event.isShortcutDown()) {
deselectAll();
} else {
backupSelections();
jointSkin.setSelected(true);
}
jointSkin.getRoot().toFront();
} else {
if (event.isShortcutDown()) {
jointSkin.setSelected(false);
}
}
selectionDragManager.bindPositions(joint, model);
event.consume();
}
/**
* Handles mouse-pressed events on the view.
*
* @param event a mouse-pressed event
*/
private void handleViewPressed(final MouseEvent event) {
if (!event.getButton().equals(MouseButton.PRIMARY)) {
return;
}
if (!event.isShortcutDown()) {
deselectAll();
} else {
backupSelections();
}
final double scale = view.getLocalToSceneTransform().getMxx();
final Point2D cursorPosition = GeometryUtils.getCursorPosition(event, view);
selectionBoxStart = new Point2D(cursorPosition.getX() / scale, cursorPosition.getY() / scale);
}
/**
* Handles mouse-pressed events on the connection skin to select / de-select the connection.
*
* @param event the mouse-pressed event
*/
private void handleMousePressed(final MouseEvent event) {
if (event.isShortcutDown()) {
setSelected(!isSelected());
} else if (!isSelected()) {
getGraphEditor().getSelectionManager().clearSelection();
setSelected(true);
}
event.consume();
}
/**
* Handles mouse-pressed events on the given node.
*
* @param event a mouse-pressed event
* @param node the {@link GNode} on which this event occurred
*/
private void handleNodePressed(final MouseEvent event, final GNode node) {
if (!event.getButton().equals(MouseButton.PRIMARY)) {
return;
}
final GNodeSkin nodeSkin = skinLookup.lookupNode(node);
if (!nodeSkin.isSelected()) {
if (!event.isShortcutDown()) {
deselectAll();
} else {
backupSelections();
}
nodeSkin.setSelected(true);
} else {
if (event.isShortcutDown()) {
nodeSkin.setSelected(false);
}
}
// Do not bind the positions of other selected nodes if this node is about to be resized.
if (!nodeSkin.getRoot().isMouseInPositionForResize()) {
selectionDragManager.bindPositions(node, model);
}
// Consume this event so it's not passed up to the parent (i.e. the view).
event.consume();
}
/**
* Handles mouse-pressed events on any connector.
*
* @param event a mouse-pressed event
*/
private void handleConnectorPressed(final MouseEvent event) {
if (!event.getButton().equals(MouseButton.PRIMARY)) {
return;
}
if (!event.isShortcutDown()) {
deselectAll();
}
event.consume();
}
public boolean isMenuShortcutKeyDown(MouseEvent event) {
return event.isShortcutDown();
}
/**
* Returns <code>true</code> if precise manipulations should be performed
* for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
*
* @param e
* The {@link MouseEvent} that is used to determine if precise
* manipulations should be performed (i.e. if the corresponding
* modifier key is pressed).
* @return <code>true</code> if precise manipulations should be performed,
* <code>false</code> otherwise.
*/
protected boolean isPrecise(MouseEvent e) {
return e.isShortcutDown();
}
/**
* Returns <code>true</code> if precise manipulations should be performed
* for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
*
* @param e
* The {@link MouseEvent} that is used to determine if precise
* manipulations should be performed (i.e. if the corresponding
* modifier key is pressed).
* @return <code>true</code> if precise manipulations should be performed,
* <code>false</code> otherwise.
*/
protected boolean isPrecise(MouseEvent e) {
return e.isShortcutDown();
}
/**
* Returns <code>true</code> if the selection should be extended according
* to the given {@link MouseEvent}, <code>false</code> if it should be
* replaced.
*
* @param e
* The {@link MouseEvent} for which to determine if the selection
* is to be replaced or extended.
* @return <code>true</code> if the selection should be extended according
* to the given {@link MouseEvent}, <code>false</code> if it should
* be replaced.
*/
protected boolean isAppend(MouseEvent e) {
return e.isShortcutDown();
}
/**
* Returns <code>true</code> if precise manipulations should be performed
* for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
*
* @param e
* The {@link MouseEvent} that is used to determine if precise
* manipulations should be performed (i.e. if the corresponding
* modifier key is pressed).
* @return <code>true</code> if precise manipulations should be performed,
* <code>false</code> otherwise.
*/
protected boolean isPrecise(MouseEvent e) {
return e.isShortcutDown();
}
/**
* Returns <code>true</code> if precise manipulations should be performed
* for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
*
* @param e
* The {@link MouseEvent} that is used to determine if precise
* manipulations should be performed (i.e. if the corresponding
* modifier key is pressed).
* @return <code>true</code> if precise manipulations should be performed,
* <code>false</code> otherwise.
*/
protected boolean isPrecise(MouseEvent e) {
return e.isShortcutDown();
}
/**
* Returns <code>true</code> if precise manipulations should be performed
* for the given {@link MouseEvent}. Otherwise returns <code>false</code>.
*
* @param e
* The {@link MouseEvent} that is used to determine if precise
* manipulations should be performed (i.e. if the corresponding
* modifier key is pressed).
* @return <code>true</code> if precise manipulations should be performed,
* <code>false</code> otherwise.
*/
protected boolean isPrecise(MouseEvent e) {
return e.isShortcutDown();
}