Browse Source

New>Recent size in default props

Jed 4 years ago
parent
commit
cca8cdeb8c
2 changed files with 5 additions and 2 deletions
  1. 1 0
      bin/defaultProps.json
  2. 4 2
      hide/comp/SceneEditor.hx

+ 1 - 0
bin/defaultProps.json

@@ -116,6 +116,7 @@
 	"sceneeditor.rotatePrecision": 0.1,
 
 	"sceneeditor.newgroups" : ["2D|hrt.prefab.Object2D","3D|hrt.prefab.Object3D","RFX|hrt.prefab.rfx.RendererFX"],
+	"sceneeditor.recentsize" : 6,
 
 	"sceneeditor.icons" : {},
 	"sceneeditor.ranges" : {},

+ 4 - 2
hide/comp/SceneEditor.hx

@@ -2337,7 +2337,8 @@ class SceneEditor {
 					var recents : Array<String> = ide.currentConfig.get("sceneeditor.newrecents", []);
 					recents.remove(p.type);
 					recents.unshift(p.type);
-					if (recents.length > 10) recents.pop();
+					var recentSize : Int = view.config.get("sceneeditor.recentsize");
+					if (recents.length > recentSize) recents.splice(recentSize, recents.length - recentSize);
 					ide.currentConfig.set("sceneeditor.newrecents", recents);
 					return p;
 				}
@@ -2349,7 +2350,8 @@ class SceneEditor {
 						var recents : Array<String> = ide.currentConfig.get("sceneeditor.newrecents", []);
 						recents.remove(p.type);
 						recents.unshift(p.type);
-						if (recents.length > 10) recents.pop();
+						var recentSize : Int = view.config.get("sceneeditor.recentsize");
+						if (recents.length > recentSize) recents.splice(recentSize, recents.length - recentSize);
 						ide.currentConfig.set("sceneeditor.newrecents", recents);
 					});
 				else