Commit 4241e2ff authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Use Ctrl (Windows/Linux) or Cmd (Mac) for multiselect

Change-Id: Icd6fd74d49ae11cbc13a6321112e0cf002308186
parent 85e9e4dc
...@@ -53,13 +53,13 @@ import com.google.appinventor.shared.youngandroid.YoungAndroidSourceAnalyzer; ...@@ -53,13 +53,13 @@ import com.google.appinventor.shared.youngandroid.YoungAndroidSourceAnalyzer;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gwt.core.client.Callback; import com.google.gwt.core.client.Callback;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Navigator;
import com.google.gwt.user.client.ui.DockPanel; import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
...@@ -177,18 +177,20 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen ...@@ -177,18 +177,20 @@ public final class YaFormEditor extends SimpleEditor implements FormChangeListen
RootPanel.get().addDomHandler(new KeyDownHandler() { RootPanel.get().addDomHandler(new KeyDownHandler() {
@Override @Override
public void onKeyDown(KeyDownEvent event) { public void onKeyDown(KeyDownEvent event) {
int keyCode = event.getNativeKeyCode(); if (Navigator.getPlatform().toLowerCase().startsWith("mac")) {
if (keyCode == KeyCodes.KEY_SHIFT) { shouldSelectMultipleComponents = event.isMetaKeyDown();
shouldSelectMultipleComponents = true; } else {
shouldSelectMultipleComponents = event.isControlKeyDown();
} }
} }
}, KeyDownEvent.getType()); }, KeyDownEvent.getType());
RootPanel.get().addDomHandler(new KeyUpHandler() { RootPanel.get().addDomHandler(new KeyUpHandler() {
@Override @Override
public void onKeyUp(KeyUpEvent event) { public void onKeyUp(KeyUpEvent event) {
int keyCode = event.getNativeKeyCode(); if (Navigator.getPlatform().toLowerCase().startsWith("mac")) {
if (keyCode == KeyCodes.KEY_SHIFT) { shouldSelectMultipleComponents = event.isMetaKeyDown();
shouldSelectMultipleComponents = false; } else {
shouldSelectMultipleComponents = event.isControlKeyDown();
} }
} }
}, KeyUpEvent.getType()); }, KeyUpEvent.getType());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment