Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
36b91385
Commit
36b91385
authored
Dec 03, 2019
by
Piotr Gawron
Browse files
resize handler had issues
parent
61c6f714
Pipeline
#17314
passed with stage
in 18 minutes and 28 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
36b91385
...
...
@@ -14,6 +14,8 @@ minerva (14.0.5) stable; urgency=medium
* Bug fix: exported sbml file always contain model identifier (#1013)
* Bug fix: typo allel reverted to allele in overlay data (regression 14.0.0,
#1012)
* Bug fix: after loading/removing too many plugins it was impossible to load
new plugins (#1011)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 02 Dec 2019 16:00:00 +0200
...
...
frontend-js/src/main/js/plugin/PluginManager.js
View file @
36b91385
...
...
@@ -33,7 +33,6 @@ function PluginManager(options) {
*/
self
.
_plugins
=
[];
self
.
_pluginOnResizeHandlers
=
{};
self
.
registerListenerType
(
"
onResize
"
);
self
.
addListener
(
"
onResize
"
,
function
()
{
...
...
@@ -79,6 +78,13 @@ PluginManager.prototype.addPlugin = function (options) {
$
(
self
.
getElement
()).
show
();
if
(
self
.
_panels
===
undefined
)
{
self
.
getGuiUtils
().
initTabContent
(
self
);
self
.
_adjustHeight
=
function
()
{
var
tabs
=
$
(
"
.parentTabs > .tab-content > .tab-pane
"
,
self
.
getElement
());
if
(
tabs
.
length
>
0
)
{
tabs
.
css
(
'
height
'
,
'
calc( 100vh -
'
+
$
(
"
.parentTabs > .tab-content
"
,
self
.
getElement
()).
offset
().
top
+
'
px )
'
);
}
};
GuiConnector
.
addWindowResizeEvent
(
self
.
_adjustHeight
);
}
var
element
=
Functions
.
createElement
({
type
:
"
div
"
});
...
...
@@ -113,29 +119,19 @@ PluginManager.prototype.addPlugin = function (options) {
}
return
plugin
.
load
();
}).
then
(
function
()
{
$
(
"
a[href='#
"
+
element
.
parentNode
.
id
+
"
']
"
,
$
(
self
.
getElement
()))[
0
].
innerHTML
=
plugin
.
getName
();
var
tab
=
$
(
element
.
parentNode
);
var
adjustHeight
=
function
()
{
tab
.
css
(
'
height
'
,
'
calc( 100vh -
'
+
$
(
element
.
parentNode
.
parentNode
).
offset
().
top
+
'
px )
'
);
};
self
.
_pluginOnResizeHandlers
[
plugin
.
getPluginId
()]
=
adjustHeight
;
GuiConnector
.
addWindowResizeEvent
(
adjustHeight
);
adjustHeight
();
if
(
$
(
self
.
getElement
()).
width
()
<
plugin
.
getDefaultWidth
())
{
$
(
self
.
getElement
()).
css
(
'
flex
'
,
"
0 0
"
+
plugin
.
getDefaultWidth
()
+
"
px
"
);
$
(
"
a[href='#
"
+
element
.
parentNode
.
id
+
"
']
"
,
$
(
self
.
getElement
()))[
0
].
innerHTML
=
plugin
.
getName
();
if
(
$
(
self
.
getElement
()).
width
()
<
plugin
.
getDefaultWidth
())
{
$
(
self
.
getElement
()).
css
(
'
flex
'
,
"
0 0
"
+
plugin
.
getDefaultWidth
()
+
"
px
"
);
}
self
.
_adjustHeight
();
return
self
.
adjustMinWidth
();
}
return
self
.
adjustMinWidth
();
}).
then
(
function
()
{
).
then
(
function
()
{
var
newLinkHeight
=
$
(
"
.nav-tabs
"
,
self
.
getElement
()).
height
();
if
(
self
.
_plugins
.
length
===
1
)
{
return
self
.
getMap
().
getMapCanvas
().
triggerListeners
(
"
resize
"
);
}
else
if
(
oldLinkHeight
!==
newLinkHeight
)
{
for
(
var
key
in
self
.
_pluginOnResizeHandlers
)
{
if
(
self
.
_pluginOnResizeHandlers
.
hasOwnProperty
(
key
))
{
self
.
_pluginOnResizeHandlers
[
key
]();
}
}
return
self
.
getMap
().
getMapCanvas
().
triggerListeners
(
"
resize
"
);
}
}).
then
(
function
()
{
GuiConnector
.
setUrlParam
(
"
plugins
"
,
self
.
_getLoadedPluginsAsHashList
());
...
...
@@ -145,7 +141,8 @@ PluginManager.prototype.addPlugin = function (options) {
GuiConnector
.
alert
(
"
Problem with loading plugin:<br/>
"
+
e
.
message
);
});
});
};
}
;
/**
*
...
...
@@ -218,13 +215,13 @@ PluginManager.prototype.removePlugin = function (plugin) {
if
(
!
found
)
{
return
Promise
.
reject
(
new
Error
(
"
Plugin not registered
"
));
}
GuiConnector
.
removeWindowResizeEvent
(
self
.
_pluginOnResizeHandlers
[
plugin
.
getPluginId
()]);
return
plugin
.
unload
().
then
(
function
()
{
GuiConnector
.
setUrlParam
(
"
plugins
"
,
self
.
_getLoadedPluginsAsHashList
());
if
(
self
.
_plugins
.
length
===
0
)
{
$
(
self
.
getElement
()).
hide
();
return
self
.
getMap
().
getMapCanvas
().
triggerListeners
(
"
resize
"
);
}
else
{
self
.
_adjustHeight
();
return
self
.
adjustMinWidth
();
}
});
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment