[view] add fullscreen icons

This commit is contained in:
2020-03-23 22:00:54 +03:00
parent a1402d2a04
commit 9dc3eb4e04
9 changed files with 56 additions and 34 deletions

View File

@@ -1,7 +1,9 @@
package ru.m;
import flash.display.StageDisplayState;
import flash.events.FullScreenEvent;
import flash.Lib;
import haxework.signal.Signal;
enum abstract Platform(String) from String to String {
var ANDROID = "android";
@@ -52,14 +54,24 @@ class Device {
#end
}
public static var fullScreenSignal(get, null):Signal<Bool>;
private static function get_fullScreenSignal():Signal<Bool> {
if (fullScreenSignal == null) {
fullScreenSignal = new Signal();
Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN, (event:FullScreenEvent) -> fullScreenSignal.emit(event.fullScreen));
}
return fullScreenSignal;
}
public static var fullScreenSupport(get, never):Bool;
public static function get_fullScreenSupport():Bool {
return Lib.current.stage.allowsFullScreenInteractive;
return Lib.current.stage.allowsFullScreen;
}
public static function toggleFullScreen():Void {
Lib.current.stage.displayState = Lib.current.stage.displayState == StageDisplayState.NORMAL ?
StageDisplayState.FULL_SCREEN_INTERACTIVE : StageDisplayState.NORMAL;
StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
}
}