[view] add fullscreen icons
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user