From 79f3a98e8bdf65b922f40165fb795cbdff36e880 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 30 Oct 2018 12:51:03 -0400 Subject: [PATCH] Keep points the same pixel size on zoom. Ideally this would be an option that multiple renderers could honor. --- src/vtkjs/pointFeature.js | 6 ++++++ src/vtkjs/vtkjsRenderer.js | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vtkjs/pointFeature.js b/src/vtkjs/pointFeature.js index 579baaf259..6b972c90b9 100644 --- a/src/vtkjs/pointFeature.js +++ b/src/vtkjs/pointFeature.js @@ -127,6 +127,12 @@ var vtkjs_pointFeature = function (arg) { if (m_this.dataTime().getMTime() >= m_this.buildTime().getMTime() || m_this.updateTime().getMTime() < m_this.getMTime()) { m_this._build(); + } else { + var data = m_this.data(), + radFunc = m_this.style.get('radius'), + rad = radFunc(data[0], 0); + rad *= m_this.layer().map().unitsPerPixel(m_this.layer().map().zoom()); + m_source.setRadius(rad); } m_this.updateTime().modified(); diff --git a/src/vtkjs/vtkjsRenderer.js b/src/vtkjs/vtkjsRenderer.js index b48f913dc6..4e62395880 100644 --- a/src/vtkjs/vtkjsRenderer.js +++ b/src/vtkjs/vtkjsRenderer.js @@ -33,7 +33,7 @@ var vtkjsRenderer = function (arg) { background: [0, 0, 0, 0]}); vtkRenderer.setContainer(m_this.layer().node().get(0)); // TODO: Is there a way to start with no interactor rather than unbinding it? - vtkRenderer.getInteractor().unbindEvents() + vtkRenderer.getInteractor().unbindEvents(); vtkRenderer.resize(); var vtkjsren = vtkRenderer.getRenderer(); var renderWindow = vtkRenderer.getRenderWindow(); @@ -151,9 +151,8 @@ var vtkjsRenderer = function (arg) { * produce a pan */ m_this.layer().geoOn(geo_event.pan, function (evt) { - // TODO: If the zoom level has changed, our point size needs to be - // recalculated, so we should call m_this._render - // DO NOTHING + // TODO: We may only need to do this if the zoom level has changed. + m_this._render(); }); /**