Browse Source

Made percent value edition more intuitive

Clement Espeute 2 years ago
parent
commit
bc3d8d4029
1 changed files with 5 additions and 1 deletions
  1. 5 1
      hide/comp/cdb/Cell.hx

+ 5 - 1
hide/comp/cdb/Cell.hx

@@ -674,7 +674,8 @@ class Cell {
 		case TString if( column.kind == Script ):
 			open();
 		case TInt, TFloat, TString, TId, TCustom(_), TDynamic:
-			var str = value == null ? "" : Std.isOfType(value, String) ? value : editor.base.valToString(column.type, value);
+			var isPercent = column.display == Percent;
+			var str = value == null ? "" : Std.isOfType(value, String) ? value : editor.base.valToString(column.type, value, false, isPercent);
 
 			elementHtml.innerHTML = null;
 			elementHtml.classList.add("edit");
@@ -1154,6 +1155,9 @@ class Cell {
 		} else
 			newValue = str;
 
+		if (column.display == Percent)
+			newValue *= 0.01;
+
 		if( newValue == null || newValue == currentValue )
 			return;