Skip to content

Commit

Permalink
A littel workaround to get manager to work witout the need of meta file.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-wu committed Jul 2, 2019
1 parent a88b98b commit 77a1de2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/modelsLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ exports.ModelsLoader = function() {
xmlhttp.send();
}

this.initialiseLoading = function() {
this.initialiseLoading = function(url) {
if (metaFilesReady == false) {
if (url)
this.systemMetaURL = url;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
Expand Down
10 changes: 7 additions & 3 deletions src/modules/organsRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,13 @@ var OrgansViewer = function(ModelsLoaderIn) {
geometries[i].setVisibility(value);
}
var glyphsets = _this.scene.findGlyphsetsWithGroupName(name);
for (var i = 0; i < glyphsets.length; i ++ ) {
glyphsets[i].setVisibility(value);
}
for (var i = 0; i < glyphsets.length; i ++ ) {
glyphsets[i].setVisibility(value);
}
var pointsets = _this.scene.findPointsetsWithGroupName(name);
for (var i = 0; i < pointsets.length; i ++ ) {
pointsets[i].setVisibility(value);
}
if (pickerScene) {
geometries = pickerScene.findGeometriesWithGroupName(name);
for (var i = 0; i < geometries.length; i ++ ) {
Expand Down
7 changes: 0 additions & 7 deletions src/ui/gridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ exports.GridView = function(containerIn) {
var containment = getNewItemContainer();
dialog.dockToContainment(containment);
dialogs.push(dialog);
updateSize();
}
}
}
Expand All @@ -88,12 +87,6 @@ exports.GridView = function(containerIn) {
removeDialog(dialog);
}

var resize = function() {
return function() {
updateSize();
}
}

var setup = function() {
parent = $(template);
rowElement = parent.find(".Row")[0];
Expand Down
21 changes: 12 additions & 9 deletions src/utilities/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var MANAGER_ITEM_CHANGE = require("./managerItem").MANAGER_ITEM_CHANGE;
var _ = require("lodash/lang");

exports.ModuleManager = function() {
var ready = false;
var metaLoaded= false;
var moduleCounter = 0;
var name = "Default Manager";
var gridView = undefined;
Expand Down Expand Up @@ -274,7 +274,7 @@ exports.ModuleManager = function() {
}

this.createDialog = function(module, parent, options) {
if (module && ready) {
if (module) {
if (constructors[module.typeName]) {
var dialog = constructors[module.typeName].dialog(module, parent, options);
_this.manageDialog(dialog);
Expand Down Expand Up @@ -306,7 +306,7 @@ exports.ModuleManager = function() {
}

this.createModule = function(moduleName) {
if (modelsLoader && ready) {
if (modelsLoader) {
var module = constructors[moduleName].module();
if (module) {
moduleCounter = moduleCounter + 1;
Expand Down Expand Up @@ -340,8 +340,8 @@ exports.ModuleManager = function() {
eventNotifier.unsubscribe(subscription);
}

this.isReady = function() {
return ready;
this.isMetaReady = function() {
return metaLoaded;
}

this.initialiseGridView = function(container) {
Expand Down Expand Up @@ -480,14 +480,17 @@ exports.ModuleManager = function() {

var systemMetaReadyCallback = function() {
return function() {
ready = true;
metaLoaded = true;
}
}

this.initialiseModelsLoader = function(url) {
modelsLoader.addSystemMetaIsReadyCallback(systemMetaReadyCallback());
modelsLoader.initialiseLoading(url);
}

var initialise = function() {
modelsLoader = new (require("../modelsLoader").ModelsLoader)();
modelsLoader.addSystemMetaIsReadyCallback(systemMetaReadyCallback());
modelsLoader.initialiseLoading();
modelsLoader = new (require("../modelsLoader").ModelsLoader)();
subscription = eventNotifier.subscribe(_this, eventNotifierCallback(), undefined);
}

Expand Down

0 comments on commit 77a1de2

Please sign in to comment.