Skip to content

Commit

Permalink
fix of group selection
Browse files Browse the repository at this point in the history
  • Loading branch information
raydac committed Dec 28, 2019
1 parent 87fe803 commit 34b4c3f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ public interface VisualAttributePlugin extends AttributePlugin {
/**
* Process click on image represents the attribute,
*
* @param context the plugin context
* @param topic the topic
* @param clickCount detected number of mouse clicks
* @param context the plugin context
* @param topic the topic
* @param activeGroupModifier true if any modifier to work with topic group (like SHIFT or CTRL) is active
* @param clickCount detected number of mouse clicks
* @return true if the map was changed for the operation, false otherwise
* @since 1.4.7
*/
boolean onClick(@Nonnull PluginContext context, @Nonnull Topic topic, int clickCount);
boolean onClick(@Nonnull PluginContext context, @Nonnull Topic topic, boolean activeGroupModifier, int clickCount);

/**
* Get tool-tip for image represents the attribute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Renderable getScaledImage(@Nonnull final MindMapPanelConfig config, @Nonn
}

@Override
public boolean onClick(@Nonnull PluginContext context, @Nonnull final Topic topic, int clickCount) {
public boolean onClick(final @Nonnull PluginContext context, final @Nonnull Topic topic, final boolean activeGroupModifier, final int clickCount) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ private Image extractImage(@Nonnull final Topic topic) {
}

@Override
public boolean onClick(@Nonnull PluginContext context, @Nonnull final Topic activeTopic, final int clickCount) {
public boolean onClick(@Nonnull final PluginContext context, @Nonnull final Topic topic, final boolean activeGroupModifier, final int clickCount) {
if (clickCount > 1) {
final String imageFilePathUri = activeTopic.getAttribute(ATTR_IMAGE_URI_KEY);
final String imageFilePathUri = topic.getAttribute(ATTR_IMAGE_URI_KEY);
if (imageFilePathUri != null) {
try {
context.openFile(new MMapURI(imageFilePathUri).asFile(context.getProjectFolder()), false);
Expand All @@ -84,7 +84,10 @@ public boolean onClick(@Nonnull PluginContext context, @Nonnull final Topic acti
}
}
} else {
context.getPanel().select(activeTopic, false);
if (!activeGroupModifier) {
context.getPanel().removeAllSelection();
}
context.getPanel().select(topic, false);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ public void mouseClicked(@Nonnull final MouseEvent e) {
if (plugin.isClickable(context, element.getModel())) {
processedByPlugin = true;
try {
if (plugin.onClick(context, element.getModel(), e.getClickCount())) {
if (plugin.onClick(context, element.getModel(), e.isShiftDown() || e.isControlDown(), e.getClickCount())) {
doLayout();
revalidate();
repaint();
Expand Down

0 comments on commit 34b4c3f

Please sign in to comment.