d3-celestial icon indicating copy to clipboard operation
d3-celestial copied to clipboard

Bug when specifying zoomlevel in config

Open eisenfaust12 opened this issue 4 years ago • 1 comments

Hi,

there appears to be a bug when specifying a zoomlevel in the config that is passed to Celestial.display where the size and exponent values for stars are not properly evaluated. The stars are rendered much too tiny. Take a look at the following two pictures. The first one didn't have a zoomlevel specified and I zoomed in manually with the mouse-wheel. The second one has a specified zoomlevel of 5.

Does Anyone have an idea how to fix this? Thanks! good bad

eisenfaust12 avatar Apr 26 '21 19:04 eisenfaust12

Well, I seemingly "fixed" it by commenting out line 71 in Celestial.display in celestial.js , i.e.

  mapProjection = Celestial.projection(cfg.projection).rotate(rotation).translate([canvaswidth/2, canvasheight/2]).scale(scale * zoomlevel);
    
  zoom = d3.geo.zoom().projection(mapProjection).center([canvaswidth/2, canvasheight/2]).scaleExtent([scale, scale * zoomextent]).on("zoom.redraw", redraw);
  // Set initial zoom level
//  scale *= zoomlevel;

  var canvas = d3.select(parentElement).selectAll("canvas"),
      culture = (cfg.culture !== "" && cfg.culture !== "iau") ? cfg.culture : "";
  

But I don't understand the code well enough and I assume this line is there for a reason. Maybe you can have a look @ofrohn ? Thanks!

eisenfaust12 avatar Apr 26 '21 19:04 eisenfaust12