Browse Source

minor dropdown fixes

ncannasse 8 năm trước cách đây
mục cha
commit
0566e79875
1 tập tin đã thay đổi với 13 bổ sung4 xóa
  1. 13 4
      h2d/Dropdown.hx

+ 13 - 4
h2d/Dropdown.hx

@@ -145,13 +145,17 @@ class Dropdown extends Flow {
 	}
 
 	public function open() {
-		getScene().add(dropdownList, dropdownLayer);
-		onOpen();
+		if( dropdownList.parent == null ) {
+			getScene().add(dropdownList, dropdownLayer);
+			onOpen();
+		}
 	}
 
 	public function close() {
-		dropdownList.remove();
-		onClose();
+		if( dropdownList.parent != null ) {
+			dropdownList.remove();
+			onClose();
+		}
 	}
 
 	public function get_dropdownCursor() {
@@ -162,6 +166,11 @@ class Dropdown extends Flow {
 		return cursor.tile = c;
 	}
 
+	override function onRemove() {
+		super.onRemove();
+		close();
+	}
+
 	public dynamic function onOpen() {
 	}