mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-27 15:37:49 +00:00
proper dialog fading
This commit is contained in:
parent
028e90474c
commit
4193cd4ee2
4
hmm.json
4
hmm.json
|
@ -49,14 +49,14 @@
|
|||
"name": "haxeui-core",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "5d4ac180f85b39e72624f4b8d17925d91ebe4278",
|
||||
"ref": "032192e849cdb7d1070c0a3241c58ee555ffaccc",
|
||||
"url": "https://github.com/haxeui/haxeui-core"
|
||||
},
|
||||
{
|
||||
"name": "haxeui-flixel",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "89a4cf621e5c204922f7a12fbde5d1d84f8b47f5",
|
||||
"ref": "d90758b229d05206400df867d333c79d9fdbd478",
|
||||
"url": "https://github.com/haxeui/haxeui-flixel"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -2643,7 +2643,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
* Open the backups folder in the file explorer.
|
||||
* Don't call this on HTML5.
|
||||
*/
|
||||
function openBackupsFolder():Void
|
||||
function openBackupsFolder(?_):Void
|
||||
{
|
||||
#if sys
|
||||
// TODO: Is there a way to open a folder and highlight a file in it?
|
||||
|
|
|
@ -29,6 +29,12 @@ class ChartEditorBaseDialog extends Dialog
|
|||
this.onDialogClosed = event -> onClose(event);
|
||||
}
|
||||
|
||||
public override function showDialog(modal:Bool = true):Void
|
||||
{
|
||||
super.showDialog(modal);
|
||||
fadeInComponent(this, 1);
|
||||
}
|
||||
|
||||
private override function onReady():Void
|
||||
{
|
||||
_overlay.opacity = 0;
|
||||
|
@ -65,8 +71,8 @@ class ChartEditorBaseDialog extends Dialog
|
|||
this.closable = params.closable ?? false;
|
||||
}
|
||||
|
||||
static final OVERLAY_EASE_DURATION:Float = 5.0;
|
||||
static final OVERLAY_EASE_TYPE:String = "linear";
|
||||
static final OVERLAY_EASE_DURATION:Float = 0.2;
|
||||
static final OVERLAY_EASE_TYPE:String = "easeOut";
|
||||
|
||||
function fadeInDialogOverlay():Void
|
||||
{
|
||||
|
@ -82,11 +88,16 @@ class ChartEditorBaseDialog extends Dialog
|
|||
return;
|
||||
}
|
||||
|
||||
var builder = new AnimationBuilder(_overlay, OVERLAY_EASE_DURATION, "linear");
|
||||
builder.setPosition(0, "opacity", 0, true); // 0% absolute
|
||||
builder.setPosition(100, "opacity", 1, true);
|
||||
fadeInComponent(_overlay, 0.5);
|
||||
}
|
||||
|
||||
trace('Fading in dialog overlay...');
|
||||
function fadeInComponent(component:Component, fadeTo:Float = 1):Void
|
||||
{
|
||||
var builder = new AnimationBuilder(component, OVERLAY_EASE_DURATION, OVERLAY_EASE_TYPE);
|
||||
builder.setPosition(0, "opacity", 0, true); // 0% absolute
|
||||
builder.setPosition(100, "opacity", fadeTo, true);
|
||||
|
||||
trace('Fading in dialog component...');
|
||||
builder.play();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import haxe.ui.containers.HBox;
|
|||
import haxe.ui.notifications.Notification;
|
||||
import haxe.ui.notifications.NotificationManager;
|
||||
import haxe.ui.notifications.NotificationType;
|
||||
import haxe.ui.notifications.NotificationData.NotificationActionData;
|
||||
|
||||
class ChartEditorNotificationHandler
|
||||
{
|
||||
|
@ -77,7 +78,7 @@ class ChartEditorNotificationHandler
|
|||
* @param actions The actions to add to the notification.
|
||||
* @return The notification that was sent.
|
||||
*/
|
||||
public static function infoWithActions(state:ChartEditorState, title:String, body:String, actions:Array<NotificationAction>):Notification
|
||||
public static function infoWithActions(state:ChartEditorState, title:String, body:String, actions:Array<NotificationActionData>):Notification
|
||||
{
|
||||
return sendNotification(state, title, body, NotificationType.Info, actions);
|
||||
}
|
||||
|
@ -101,7 +102,8 @@ class ChartEditorNotificationHandler
|
|||
NotificationManager.instance.removeNotification(notif);
|
||||
}
|
||||
|
||||
static function sendNotification(state:ChartEditorState, title:String, body:String, ?type:NotificationType, ?actions:Array<NotificationAction>):Notification
|
||||
static function sendNotification(state:ChartEditorState, title:String, body:String, ?type:NotificationType,
|
||||
?actions:Array<NotificationActionData>):Notification
|
||||
{
|
||||
var actionNames:Array<String> = actions == null ? [] : actions.map(action -> action.text);
|
||||
|
||||
|
@ -111,10 +113,10 @@ class ChartEditorNotificationHandler
|
|||
body: body,
|
||||
type: type ?? NotificationType.Default,
|
||||
expiryMs: Constants.NOTIFICATION_DISMISS_TIME,
|
||||
actions: actionNames
|
||||
actions: actions
|
||||
});
|
||||
|
||||
if (actionNames.length > 0)
|
||||
if (actions != null && actions.length > 0)
|
||||
{
|
||||
// TODO: Tell Ian that this is REALLY dumb.
|
||||
var actionsContainer:HBox = notif.findComponent('actionsContainer', HBox);
|
||||
|
@ -122,13 +124,13 @@ class ChartEditorNotificationHandler
|
|||
if (Std.isOfType(component, Button))
|
||||
{
|
||||
var button:Button = cast component;
|
||||
var action:Null<NotificationAction> = actions.find(action -> action.text == button.text);
|
||||
var action:Null<NotificationActionData> = actions.find(action -> action.text == button.text);
|
||||
if (action != null && action.callback != null)
|
||||
{
|
||||
button.onClick = function(_) {
|
||||
// Don't allow actions to be clicked while the playtest is open.
|
||||
if (state.subState != null) return;
|
||||
action.callback();
|
||||
action.callback(action);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue