').addClass ('ov_tree_item_button_container').insertBefore (this.nameElement);
+ this.openCloseButton = OV.AddSvgIcon (buttonContainer, this.openButtonIcon, 'ov_tree_item_button');
}
ShowChildren (show, onComplete)
@@ -181,24 +123,10 @@ OV.TreeViewGroupItem = class extends OV.TreeViewItem
}
if (show) {
OV.SetSvgIconImage (this.openCloseButton, this.openButtonIcon);
- if (this.animated) {
- this.childrenDiv.slideDown (400, onComplete);
- } else {
- this.childrenDiv.show ();
- if (onComplete) {
- onComplete ();
- }
- }
+ this.childrenDiv.slideDown (400, onComplete);
} else {
OV.SetSvgIconImage (this.openCloseButton, this.closeButtonIcon);
- if (this.animated) {
- this.childrenDiv.slideUp (400, onComplete);
- } else {
- this.childrenDiv.hide ();
- if (onComplete) {
- onComplete ();
- }
- }
+ this.childrenDiv.slideUp (400, onComplete);
}
}
@@ -211,33 +139,16 @@ OV.TreeViewGroupItem = class extends OV.TreeViewItem
this.mainElement.click ((ev) => {
this.showChildren = !this.showChildren;
this.ShowChildren (this.showChildren, null);
- if (this.openCloseHandler !== null) {
- this.openCloseHandler ();
- }
});
}
return this.childrenDiv;
}
- GetChildrenDiv ()
- {
- return this.childrenDiv;
- }
-
AddChild (child)
{
this.CreateChildrenDiv ();
child.SetParent (this);
- child.CreateDomElement (this.childrenDiv);
- }
-
- CreateDomElement (parentDiv)
- {
- this.CreateMainElement (parentDiv);
- OV.CreateSvgIcon (this.mainElement, this.iconPath, 'ov_tree_item_icon');
- let buttonContainer = $('
').addClass ('ov_tree_item_button_container').appendTo (this.mainElement);
- this.openCloseButton = OV.CreateSvgIcon (buttonContainer, this.openButtonIcon, 'ov_tree_item_button');
- this.CreateNameElement ();
+ child.AddDomElements (this.childrenDiv);
}
};
@@ -250,7 +161,7 @@ OV.TreeView = class
AddItem (item)
{
- item.CreateDomElement (this.mainDiv);
+ item.AddDomElements (this.mainDiv);
}
Clear ()
diff --git a/website/o3dv/js/utils.js b/website/o3dv/js/utils.js
index 7a3596d..9591fd7 100644
--- a/website/o3dv/js/utils.js
+++ b/website/o3dv/js/utils.js
@@ -42,7 +42,7 @@ OV.InstallTooltip = function (item, text)
let itemWidth = item.outerWidth (true);
let itemHeight = item.outerHeight (true);
let tooltipWidth = tooltip.outerWidth (true);
-
+
let tooltipMargin = 10;
let left = itemOffset.left + itemWidth / 2 - tooltipWidth / 2;
if (left + tooltipWidth > windowWidth - tooltipMargin) {
@@ -61,7 +61,7 @@ OV.InstallTooltip = function (item, text)
if (!OV.IsHoverEnabled ()) {
return;
}
-
+
let bodyObj = $(document.body);
let tooltip = null;
item.hover (
@@ -104,9 +104,9 @@ OV.DownloadArrayBufferAsFile = function (arrayBuffer, fileName)
OV.DownloadUrlAsFile (url, fileName);
};
-OV.CreateSvgIcon = function (parent, iconName, extraClass)
+OV.CreateSvgIcon = function (iconName, extraClass)
{
- let div = $('
').addClass ('ov_svg_icon').appendTo (parent);
+ let div = $('
').addClass ('ov_svg_icon');
$('').addClass ('icon').addClass ('icon-' + iconName).appendTo (div);
if (extraClass !== undefined && extraClass !== null) {
div.addClass (extraClass);
@@ -114,6 +114,13 @@ OV.CreateSvgIcon = function (parent, iconName, extraClass)
return div;
};
+OV.AddSvgIcon = function (parent, iconName, extraClass)
+{
+ let div = OV.CreateSvgIcon (iconName, extraClass);
+ div.appendTo (parent);
+ return div;
+};
+
OV.SetSvgIconImage = function (icon, iconName)
{
icon.empty ();
@@ -127,7 +134,7 @@ OV.CreateHeaderButton = function (iconName, title, link)
buttonLink.attr ('target', '_blank');
buttonLink.attr ('rel', 'noopener noreferrer');
OV.InstallTooltip (buttonLink, title);
- OV.CreateSvgIcon (buttonLink, iconName, 'header_button');
+ OV.AddSvgIcon (buttonLink, iconName, 'header_button');
return buttonLink;
};