|
@@ -460,6 +460,9 @@ class Prefab extends FileView {
|
|
tools.addColor(tool.title, tool.colorFunction);
|
|
tools.addColor(tool.title, tool.colorFunction);
|
|
case Range:
|
|
case Range:
|
|
tools.addRange(tool.title, tool.rangeFunction, 1.);
|
|
tools.addRange(tool.title, tool.rangeFunction, 1.);
|
|
|
|
+ case Menu:
|
|
|
|
+ var menu = tools.addMenu(tool.icon, tool.title);
|
|
|
|
+ menu.setContent(tool.menuItems());
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -675,21 +678,6 @@ class Prefab extends FileView {
|
|
for(f in filters) {
|
|
for(f in filters) {
|
|
sceneFilters.set(f, getDisplayState("sceneFilters/" + f) != false);
|
|
sceneFilters.set(f, getDisplayState("sceneFilters/" + f) != false);
|
|
}
|
|
}
|
|
-
|
|
|
|
- var sceneFiltersMenu = layerToolbar.addMenu("", "Scene filters");
|
|
|
|
- var content : Array<hide.comp.ContextMenu.ContextMenuItem> = [];
|
|
|
|
- var initDone = false;
|
|
|
|
- for(typeid in sceneFilters.keys()) {
|
|
|
|
- content.push({label : typeid, checked : sceneFilters[typeid], click : function() {
|
|
|
|
- var on = !sceneFilters[typeid];
|
|
|
|
- sceneFilters.set(typeid, on);
|
|
|
|
- if(initDone)
|
|
|
|
- applySceneFilter(typeid, on);
|
|
|
|
- content.find(function(item) return item.label == typeid).checked = on;
|
|
|
|
- }});
|
|
|
|
- }
|
|
|
|
- sceneFiltersMenu.setContent(content);
|
|
|
|
- initDone = true;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function initGraphicsFilters() {
|
|
function initGraphicsFilters() {
|
|
@@ -706,20 +694,28 @@ class Prefab extends FileView {
|
|
for(f in filters) {
|
|
for(f in filters) {
|
|
graphicsFilters.set(f, getDisplayState("graphicsFilters/" + f) != false);
|
|
graphicsFilters.set(f, getDisplayState("graphicsFilters/" + f) != false);
|
|
}
|
|
}
|
|
- var graphicsFiltersMenu = layerToolbar.addMenu("", "Graphics filters");
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function filtersToMenuItem(filters : Map<String, Bool>, type : String) : Array<hide.comp.ContextMenu.ContextMenuItem> {
|
|
var content : Array<hide.comp.ContextMenu.ContextMenuItem> = [];
|
|
var content : Array<hide.comp.ContextMenu.ContextMenuItem> = [];
|
|
var initDone = false;
|
|
var initDone = false;
|
|
- for(typeid in graphicsFilters.keys()) {
|
|
|
|
- content.push({label : typeid, checked : graphicsFilters[typeid], click : function() {
|
|
|
|
- var on = !graphicsFilters[typeid];
|
|
|
|
- graphicsFilters.set(typeid, on);
|
|
|
|
|
|
+ for(typeid in filters.keys()) {
|
|
|
|
+ content.push({label : typeid, checked : filters[typeid], click : function() {
|
|
|
|
+ var on = !filters[typeid];
|
|
|
|
+ filters.set(typeid, on);
|
|
if(initDone)
|
|
if(initDone)
|
|
- applyGraphicsFilters(typeid, on);
|
|
|
|
|
|
+ switch (type){
|
|
|
|
+ case "Graphics":
|
|
|
|
+ applyGraphicsFilters(typeid, on);
|
|
|
|
+ case "Scene":
|
|
|
|
+ applySceneFilter(typeid, on);
|
|
|
|
+ }
|
|
|
|
+
|
|
content.find(function(item) return item.label == typeid).checked = on;
|
|
content.find(function(item) return item.label == typeid).checked = on;
|
|
}});
|
|
}});
|
|
}
|
|
}
|
|
- graphicsFiltersMenu.setContent(content);
|
|
|
|
initDone = true;
|
|
initDone = true;
|
|
|
|
+ return content;
|
|
}
|
|
}
|
|
|
|
|
|
function applyTreeStyle(p: PrefabElement, el: Element, pname: String) {
|
|
function applyTreeStyle(p: PrefabElement, el: Element, pname: String) {
|