Skip to content

Commit

Permalink
Keep points the same pixel size on zoom.
Browse files Browse the repository at this point in the history
Ideally this would be an option that multiple renderers could honor.
  • Loading branch information
manthey committed Oct 30, 2018
1 parent d4a5cdb commit 79f3a98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/vtkjs/pointFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 3 additions & 4 deletions src/vtkjs/vtkjsRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
});

/**
Expand Down

0 comments on commit 79f3a98

Please sign in to comment.