GithubHelp home page GithubHelp logo

Comments (4)

vasturiano avatar vasturiano commented on July 19, 2024

@Jianan-Li to set the rotation/scale programmatically you don't need this module. You can do it directly on the D3 projection itself, with https://github.com/d3/d3-geo#projection_rotate and https://github.com/d3/d3-geo#projection_scale.

This module is simply aconvenience layer to control those projection parameters by means of user interaction.

from d3-geo-zoom.

antonytrupe avatar antonytrupe commented on July 19, 2024

I think this is the same thing I am experiencing...
After a user zoom and then a programmatic change of the scale via projection.scale, the next user interaction reverts the scale to the pre-programmatic value, if that makes sense. My hunch is something is storing the scale internally somewhere and ignoring the projection's current scale.

from d3-geo-zoom.

antonytrupe avatar antonytrupe commented on July 19, 2024

I'm not sure what all ev.transform.k on https://github.com/vasturiano/d3-geo-zoom/blob/master/src/geoZoom.js#L51 is based on. It seems to be 'remembering' previous zooms, which I think it needs to in order to know the change, but I don't know how to influence it so it "sees" programmatic changes to zoom/scale.

from d3-geo-zoom.

antonytrupe avatar antonytrupe commented on July 19, 2024

Found a solution. My specific case was programmatically resetting to the original orientation/scale as when zoom was added, so returning to the zoomIdentity makes geozoom aware of that.
d3.select(canvas).call(d3.zoom().transform,d3.zoomIdentity);

from d3-geo-zoom.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.