فهرست منبع

[cdb] Fix flags popup going out of bounds

Clément Espeute 9 ماه پیش
والد
کامیت
787bfb91fe
4فایلهای تغییر یافته به همراه15 افزوده شده و 9 حذف شده
  1. 2 0
      bin/style.css
  2. 3 0
      bin/style.less
  3. 2 2
      hide/comp/Popup.hx
  4. 8 7
      hide/comp/cdb/Cell.hx

+ 2 - 0
bin/style.css

@@ -26,6 +26,8 @@ body {
   padding: 0;
   padding: 0;
   background-color: black;
   background-color: black;
   user-select: none;
   user-select: none;
+  max-width: 100vw;
+  max-height: 100vh;
 }
 }
 .lm_header .lm_tab {
 .lm_header .lm_tab {
   font-family: var(--default-font), Serif !important;
   font-family: var(--default-font), Serif !important;

+ 3 - 0
bin/style.less

@@ -31,6 +31,9 @@ body {
 	padding : 0;
 	padding : 0;
 	background-color : black;
 	background-color : black;
 	user-select:none;
 	user-select:none;
+
+	max-width: 100vw;
+	max-height: 100vh;
 }
 }
 
 
 .lm_header .lm_tab {
 .lm_header .lm_tab {

+ 2 - 2
hide/comp/Popup.hx

@@ -107,10 +107,10 @@ class Popup extends Component {
 		var clientWidth = Browser.document.documentElement.clientWidth;
 		var clientWidth = Browser.document.documentElement.clientWidth;
 
 
 		offset.top += refElement.get(0).offsetHeight;
 		offset.top += refElement.get(0).offsetHeight;
-		offset.top = Math.min(offset.top,  clientHeight - popupHeight - 32);
+		offset.top = Math.min(offset.top,  clientHeight - popupHeight - 16);
 
 
 		//offset.left += element.get(0).offsetWidth;
 		//offset.left += element.get(0).offsetWidth;
-		offset.left = Math.min(offset.left,  clientWidth - popupWidth - 32);
+		offset.left = Math.min(offset.left,  clientWidth - popupWidth - 16);
 
 
 		element.offset(offset);
 		element.offset(offset);
 	}
 	}

+ 8 - 7
hide/comp/cdb/Cell.hx

@@ -1050,7 +1050,11 @@ class Cell {
 			}, false, (currentValue == '') ? null : currentValue);
 			}, false, (currentValue == '') ? null : currentValue);
 			#end
 			#end
 		case TFlags(values):
 		case TFlags(values):
-			var div = new Element("<div>").addClass("flagValues");
+			elementHtml.innerHTML = null;
+
+			var modal = new hide.comp.Popup(new Element(elementHtml));
+			var div = modal.element;
+			div.addClass("flagValues");
 			div.click(function(e) e.stopPropagation()).dblclick(function(e) e.stopPropagation());
 			div.click(function(e) e.stopPropagation()).dblclick(function(e) e.stopPropagation());
 			var view = table.view;
 			var view = table.view;
 			var mask = -1;
 			var mask = -1;
@@ -1074,14 +1078,11 @@ class Cell {
 					new Element('<i style="margin-left: 5px" class="ico ico-book"/>').appendTo(line);
 					new Element('<i style="margin-left: 5px" class="ico ico-book"/>').appendTo(line);
 				}
 				}
 			}
 			}
-			elementHtml.innerHTML = null;
-			var modal = new Element("<div>").addClass("hide-modal");
-			elementHtml.appendChild(modal.get(0));
-			elementHtml.appendChild(div.get(0));
-			modal.click(function(e) {
+			modal.onClose = () -> {
 				setValue(val);
 				setValue(val);
 				closeEdit();
 				closeEdit();
-			});
+			};
+			@:privateAccess modal.reflow();
 		case TTilePos:
 		case TTilePos:
 			var modal = new hide.comp.Modal.Modal2(new Element(elementHtml), "Tile Picker", "tile-picker");
 			var modal = new hide.comp.Modal.Modal2(new Element(elementHtml), "Tile Picker", "tile-picker");
 			//var modal = new hide.comp.Modal(new Element(elementHtml));
 			//var modal = new hide.comp.Modal(new Element(elementHtml));