Handle drop paths on ios
This commit is contained in:
+22
-13
@@ -84,6 +84,10 @@ class App {
|
||||
dropPath = dropPath.rtrim();
|
||||
dropPaths.push(dropPath);
|
||||
#end
|
||||
#if krom_ios
|
||||
// Import immediately while access to resource is unlocked
|
||||
handleDropPaths();
|
||||
#end
|
||||
});
|
||||
|
||||
System.notifyOnApplicationState(
|
||||
@@ -402,19 +406,7 @@ class App {
|
||||
isDragging = false;
|
||||
}
|
||||
|
||||
if (dropPaths.length > 0) {
|
||||
#if krom_linux
|
||||
var wait = !mouse.moved; // Mouse coords not updated on Linux during drag
|
||||
#else
|
||||
var wait = false;
|
||||
#end
|
||||
if (!wait) {
|
||||
dropX = mouse.x;
|
||||
dropY = mouse.y;
|
||||
var dropPath = dropPaths.shift();
|
||||
ImportAsset.run(dropPath, dropX, dropY);
|
||||
}
|
||||
}
|
||||
handleDropPaths();
|
||||
|
||||
if (UIBox.show) UIBox.update();
|
||||
if (UIMenu.show) UIMenu.update();
|
||||
@@ -435,6 +427,23 @@ class App {
|
||||
if (Zui.alwaysRedrawWindow && Context.ddirty < 0) Context.ddirty = 0;
|
||||
}
|
||||
|
||||
static function handleDropPaths() {
|
||||
if (dropPaths.length > 0) {
|
||||
#if krom_linux
|
||||
var wait = !mouse.moved; // Mouse coords not updated on Linux during drag
|
||||
#else
|
||||
var wait = false;
|
||||
#end
|
||||
if (!wait) {
|
||||
var mouse = Input.getMouse();
|
||||
dropX = mouse.x;
|
||||
dropY = mouse.y;
|
||||
var dropPath = dropPaths.shift();
|
||||
ImportAsset.run(dropPath, dropX, dropY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function getDragBackground(): TRect {
|
||||
var icons = Res.get("icons.k");
|
||||
if (dragLayer != null) return Res.tile50(icons, 4, 1);
|
||||
|
||||
@@ -108,7 +108,7 @@ class Context {
|
||||
#end
|
||||
public static var hscaleWasChanged = false;
|
||||
public static var exportMeshFormat = FormatObj;
|
||||
#if (krom_android || krom_ios)
|
||||
#if krom_android
|
||||
public static var nativeBrowser = false;
|
||||
#else
|
||||
public static var nativeBrowser = true;
|
||||
|
||||
@@ -312,6 +312,12 @@ class Project {
|
||||
}
|
||||
|
||||
public static function importMeshBox(path: String) {
|
||||
|
||||
#if krom_ios
|
||||
// Import immediately while access to resource is unlocked
|
||||
Data.getBlob(path, function(b: kha.Blob) {});
|
||||
#end
|
||||
|
||||
UIBox.showCustom(function(ui: Zui) {
|
||||
if (ui.tab(Id.handle(), tr("Import Mesh"))) {
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class UISidebar {
|
||||
|
||||
Context.viewIndex = -1;
|
||||
|
||||
#if (kha_android || kha_ios)
|
||||
#if (krom_android || krom_ios)
|
||||
// No mouse move events for touch, re-init last paint position on touch start
|
||||
Context.lastPaintX = -1;
|
||||
Context.lastPaintY = -1;
|
||||
|
||||
Reference in New Issue
Block a user