-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathPopUpUtil.hx
More file actions
46 lines (40 loc) · 1.16 KB
/
PopUpUtil.hx
File metadata and controls
46 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
Feathers UI
Copyright 2026 Bowler Hat LLC. All Rights Reserved.
This program is free software. You can redistribute and/or modify it in
accordance with the terms of the accompanying license agreement.
*/
package feathers.utils;
import feathers.core.PopUpManager;
import openfl.display.DisplayObject;
import openfl.display.DisplayObjectContainer;
/**
Utility functions for working with the `PopUpManager`.
@since 1.0.0
**/
class PopUpUtil {
/**
Determines if the display object is a top-level pop-up, or if it is
contained by a top-level pop-up.
@since 1.0.0
**/
public static function isTopLevelPopUpOrIsContainedByTopLevelPopUp(target:DisplayObject):Bool {
if (target.stage == null) {
return false;
}
var popUpManager = PopUpManager.forStage(target.stage);
for (i in (popUpManager.popUpCount - popUpManager.topLevelPopUpCount)...popUpManager.popUpCount) {
var popUp = popUpManager.getPopUpAt(i);
if (target == popUp) {
return true;
}
if ((popUp is DisplayObjectContainer)) {
var popUpContainer:DisplayObjectContainer = cast popUp;
if (popUpContainer.contains(target)) {
return true;
}
}
}
return false;
}
}