From 14673b880501cc140937b9f6b601e5f20c097de3 Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Wed, 13 Sep 2023 13:56:02 +0200 Subject: [PATCH] [ipython] fix canvas width/height usage Use GetCanvasWidth()/GetCanvasHeight() for obtain proper dimension Do not swap width/height arguments --- .../jupyroot/python/JupyROOT/helpers/utils.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bindings/jupyroot/python/JupyROOT/helpers/utils.py b/bindings/jupyroot/python/JupyROOT/helpers/utils.py index 4531051108258..a85553f81c81b 100644 --- a/bindings/jupyroot/python/JupyROOT/helpers/utils.py +++ b/bindings/jupyroot/python/JupyROOT/helpers/utils.py @@ -71,7 +71,7 @@ // We are in jupyter notebooks, use require.js which should be configured already requirejs.config({{ - paths: {{ 'JSRootCore' : [ 'build/jsroot', 'https://root.cern/js/7.2.1/build/jsroot', 'https://jsroot.gsi.de/7.2.1/build/jsroot' ] }} + paths: {{ 'JSRootCore' : [ 'build/jsroot', 'https://root.cern/js/7.3.4/build/jsroot', 'https://jsroot.gsi.de/7.3.4/build/jsroot' ] }} }})(['JSRootCore'], function(Core) {{ display_{jsDivId}(Core); }}); @@ -94,7 +94,7 @@ // Try loading a local version of requirejs and fallback to cdn if not possible. script_load_{jsDivId}(base_url + 'static/build/jsroot.js', function(){{ console.error('Fail to load JSROOT locally, please check your jupyter_notebook_config.py file'); - script_load_{jsDivId}('https://root.cern/js/7.2.1/build/jsroot.js', function(){{ + script_load_{jsDivId}('https://root.cern/js/7.3.4/build/jsroot.js', function(){{ document.getElementById("{jsDivId}").innerHTML = "Failed to load JSROOT"; }}); }}); @@ -529,21 +529,21 @@ def _getJsCode(self): divId = 'root_plot_' + str(self._getUID()) height = _jsCanvasHeight - width = _jsCanvasHeight + width = _jsCanvasWidth options = "all" if self.isCanvas: - height = self.drawableObject.GetWw() - width = self.drawableObject.GetWh() + if self.drawableObject.GetWindowWidth() > 0: width = self.drawableObject.GetWindowWidth() + if self.drawableObject.GetWindowHeight() > 0: height = self.drawableObject.GetWindowHeight() options = "" if self.isRCanvas: - if (self.drawableObject.GetWidth() > 0): width = self.drawableObject.GetWidth() - if (self.drawableObject.GetHeight() > 0): height = self.drawableObject.GetHeight() + if self.drawableObject.GetWidth() > 0: width = self.drawableObject.GetWidth() + if self.drawableObject.GetHeight() > 0: height = self.drawableObject.GetHeight() options = "" - thisJsCode = _jsCode.format(jsCanvasWidth = height, - jsCanvasHeight = width, + thisJsCode = _jsCode.format(jsCanvasWidth = width, + jsCanvasHeight = height, jsonContent = json, jsDrawOptions = options, jsDivId = divId)