From 587ce3f105172d255e5ca187af644b7ff306ca0c Mon Sep 17 00:00:00 2001 From: Juan Mauricio Matera Date: Fri, 19 Jan 2024 06:39:32 -0300 Subject: [PATCH] adding background and tooltips to Graphics3D (#198) --- mathics_django/web/media/js/mathics.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mathics_django/web/media/js/mathics.js b/mathics_django/web/media/js/mathics.js index 3889e0911..6be3644dc 100644 --- a/mathics_django/web/media/js/mathics.js +++ b/mathics_django/web/media/js/mathics.js @@ -266,8 +266,12 @@ function createLine(value) { return translateDOMElement(container.firstChild); } else if (container?.firstElementChild?.tagName === 'GRAPHICS3D') { const div = document.createElement('div'); - - drawGraphics3d(div, JSON.parse(container.firstElementChild.attributes.data.value)); + var json_data_value = JSON.parse(container.firstElementChild.attributes.data.value); + div.style.backgroundColor = json_data_value["background_color"]; + if ("tooltip_text" in json_data_value){ + div.title = json_data_value["tooltip_text"]; + } + drawGraphics3d(div, json_data_value); div.style.overflow = 'hidden'; div.style.position = 'relative';