[view] add fullscreen button
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
package ru.m;
|
package ru.m;
|
||||||
|
|
||||||
|
import flash.display.StageDisplayState;
|
||||||
|
import flash.Lib;
|
||||||
|
|
||||||
enum abstract Platform(String) from String to String {
|
enum abstract Platform(String) from String to String {
|
||||||
var ANDROID = "android";
|
var ANDROID = "android";
|
||||||
var LINUX = "linux";
|
var LINUX = "linux";
|
||||||
@@ -48,4 +51,15 @@ class Device {
|
|||||||
return false;
|
return false;
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var fullScreenSupport(get, never):Bool;
|
||||||
|
|
||||||
|
public static function get_fullScreenSupport():Bool {
|
||||||
|
return Lib.current.stage.allowsFullScreenInteractive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toggleFullScreen():Void {
|
||||||
|
Lib.current.stage.displayState = Lib.current.stage.displayState == StageDisplayState.NORMAL ?
|
||||||
|
StageDisplayState.FULL_SCREEN_INTERACTIVE : StageDisplayState.NORMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import haxework.view.group.VGroupView;
|
|||||||
switch event.keyCode {
|
switch event.keyCode {
|
||||||
case Keyboard.ESCAPE:
|
case Keyboard.ESCAPE:
|
||||||
switcher.change(StartFrame.ID);
|
switcher.change(StartFrame.ID);
|
||||||
|
case Keyboard.F:
|
||||||
|
Device.toggleFullScreen();
|
||||||
case _:
|
case _:
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package ru.m.puzzlez.view;
|
package ru.m.puzzlez.view;
|
||||||
|
|
||||||
|
import openfl.display.StageDisplayState;
|
||||||
|
import flash.Lib;
|
||||||
import haxework.view.data.DataView;
|
import haxework.view.data.DataView;
|
||||||
import haxework.view.form.ButtonView;
|
import haxework.view.form.ButtonView;
|
||||||
import haxework.view.frame.FrameSwitcher;
|
import haxework.view.frame.FrameSwitcher;
|
||||||
@@ -22,6 +24,7 @@ import ru.m.update.Updater;
|
|||||||
@:view("load") var loadButton:ButtonView;
|
@:view("load") var loadButton:ButtonView;
|
||||||
@:view("complete") var completeButton:ButtonView;
|
@:view("complete") var completeButton:ButtonView;
|
||||||
@:view("update") var updateButton:ButtonView;
|
@:view("update") var updateButton:ButtonView;
|
||||||
|
@:view("fullscreen") var fullscreenButton:ButtonView;
|
||||||
|
|
||||||
@:provide var storage:ImageStorage;
|
@:provide var storage:ImageStorage;
|
||||||
@:provide var switcher:FrameSwitcher;
|
@:provide var switcher:FrameSwitcher;
|
||||||
@@ -30,6 +33,7 @@ import ru.m.update.Updater;
|
|||||||
|
|
||||||
public function new() {
|
public function new() {
|
||||||
super(ID);
|
super(ID);
|
||||||
|
fullscreenButton.visible = Device.fullScreenSupport;
|
||||||
var data:Array<ImageListSource> = [];
|
var data:Array<ImageListSource> = [];
|
||||||
data.push({title: "Assets", source: storage.sources.get(AssetSource.ID)});
|
data.push({title: "Assets", source: storage.sources.get(AssetSource.ID)});
|
||||||
data.push({title: "Files", source: storage.sources.get(FileSource.ID)});
|
data.push({title: "Files", source: storage.sources.get(FileSource.ID)});
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ views:
|
|||||||
style: button.active
|
style: button.active
|
||||||
+onPress: ~appUpdater.download()
|
+onPress: ~appUpdater.download()
|
||||||
visible: false
|
visible: false
|
||||||
|
- id: fullscreen
|
||||||
|
$type: haxework.view.form.ButtonView
|
||||||
|
text: Fullscreen
|
||||||
|
+onPress: ~Device.toggleFullScreen()
|
||||||
|
visible: false
|
||||||
- $type: haxework.view.form.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
text: $r:text:version
|
text: $r:text:version
|
||||||
geometry.position: absolute
|
geometry.position: absolute
|
||||||
|
|||||||
Reference in New Issue
Block a user