GithubHelp home page GithubHelp logo

Comments (7)

tmcw avatar tmcw commented on August 11, 2024

Can you test with more current version of Modest Maps, like 2.0.0?

from modestmaps-js.

manelclos avatar manelclos commented on August 11, 2024

Fails with 2.0.0 too. The code is from http://modestmaps.com/index.html

var template = 'http://c.tiles.mapbox.com/v3/mapbox.mapbox-light/{Z}/{X}/{Y}.png';
var provider = new MM.TemplatedLayer(template);
var map = new MM.Map('map', provider);
map.setCenter({ lat: 42.51, lon: 2.68 }).setZoom(9);

from modestmaps-js.

tmcw avatar tmcw commented on August 11, 2024

Ah, that problem. Call setZoom before setCenter; setCenter corrects for zooms that go out of the map's bounds. The example on the site needs an update.

from modestmaps-js.

manelclos avatar manelclos commented on August 11, 2024

Yes that worked. Anyway, can't MM remember the center so that it is taken into account when setZoom() is called? IMHO you shouldn't need to know how it works, it should just work.

Thanks!

from modestmaps-js.

tmcw avatar tmcw commented on August 11, 2024

Yes, been thinking about this issue; I don't think modestmaps should remember the center (and thus decouple the 'real center' and the 'intended center') but setCenter might not want to, by default, bound the values - the user should need to select 'restrictions' on the map.

from modestmaps-js.

springmeyer avatar springmeyer commented on August 11, 2024

/cc @springmeyer - no bright ideas on a solution here, but I was following the mapbox.js examples for workshop prep and hit, so keen on it working more intuitively.

from modestmaps-js.

tmcw avatar tmcw commented on August 11, 2024

Fixed in the main modestmaps repo: f09f960

from modestmaps-js.

Related Issues (20)

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.