Better selection!
This commit is contained in:
@@ -563,10 +563,14 @@ class StageEditor extends UIState {
|
||||
}
|
||||
|
||||
public function selectSprite(_sprite:FunkinSprite) {
|
||||
_select_deselect(null, false);
|
||||
if(!UIUtil.getKeyState(CONTROL, PRESSED))
|
||||
_select_deselect(null, false);
|
||||
|
||||
if(_sprite is FunkinSprite) {
|
||||
selection = new Selection([cast _sprite]);
|
||||
if(selection.contains(_sprite))
|
||||
selection.remove(_sprite);
|
||||
else
|
||||
selection.push(_sprite);
|
||||
}
|
||||
updateSelection();
|
||||
}
|
||||
@@ -604,7 +608,6 @@ class StageEditor extends UIState {
|
||||
}
|
||||
|
||||
function _select_deselect(_, checkSelection:Bool = true) {
|
||||
var sprites = getSprites();// && o.animateAtlas == null);
|
||||
selection = new Selection();
|
||||
if(checkSelection) updateSelection();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.editors.ui;
|
||||
|
||||
import flixel.input.FlxInput.FlxInputState;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
import funkin.editors.ui.UIContextMenu.UIContextMenuOption;
|
||||
|
||||
@@ -14,6 +15,19 @@ class UIUtil {
|
||||
return contextMenu != null && UIState.state.curContextMenu == contextMenu;
|
||||
}
|
||||
|
||||
@:noUsing public static function fixKey(key:FlxKey):FlxKey {
|
||||
return switch(key) {
|
||||
#if mac
|
||||
case CONTROL: WINDOWS; // Remap control to the meta key
|
||||
#end
|
||||
default: key;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getKeyState(key:FlxKey, Status:FlxInputState):Bool {
|
||||
return FlxG.keys.checkStatus(fixKey(key), Status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process all options with shortcuts present in a `Array<UIContextMenuOption>`. Also checks childrens.
|
||||
* @param topMenuOptions
|
||||
@@ -41,14 +55,7 @@ class UIUtil {
|
||||
var shouldPress = Std.int(key) > 0;
|
||||
if(!shouldPress) key = -key;
|
||||
|
||||
var k = switch(key) {
|
||||
#if mac
|
||||
case CONTROL:
|
||||
WINDOWS;
|
||||
#end
|
||||
default:
|
||||
key;
|
||||
}
|
||||
var k = fixKey(key);
|
||||
if (FlxG.keys.checkStatus(k, shouldPress ? JUST_PRESSED : JUST_RELEASED)) {
|
||||
justPressed = true;
|
||||
} else if (!FlxG.keys.checkStatus(k, shouldPress ? PRESSED : RELEASED)) {
|
||||
|
||||
Reference in New Issue
Block a user