modestmaps / modestmaps-js Goto Github PK
View Code? Open in Web Editor NEWThis project forked from stamen/modestmaps-js
Modest Maps javascript port
Home Page: http://modestmaps.com
This project forked from stamen/modestmaps-js
Modest Maps javascript port
Home Page: http://modestmaps.com
As a dev dependency declared in package.json, with the bonus
of getting rid of that jar file in your project.
There seems to be a significant amount of newer work in this repository. Is it a new home? Which repo would it be better to develop against?
Via @Aibram there are some kinks in layer management that we're seeing both building larger sites on top of this and just managing a few layers - notably that one can only remove layers at indices, and so you need to do a lot of records-keeping to figure out where layers should fall in the stack.
A map element whose parents have the CSS direction
property set to rtl
will render incorrectly, with results ranging from totally borked to "almost normal".
I don't know if it makes sense for mapbox.js to set style="direction: ltr;
on map elements, but given that all of the tile and marker positioning relies on that assumption, I'd at least document this somewhere.
Cheers!
(from mapbox/mapbox.js#135 )
It would be useful to make a more usable, public version of the examples/ dir - would this just work on the github branch?
from stamen#116
Heyho,
First of all: GREAT PROJECT!
I am wondering whether it is possible to prevent an infinite scrolling on the x-axis? Like it is standard for the y-axis.
Thus the map would only be scrollable if the zoom level doesn't fit into the viewport.
Thank you,
Regards,
J
I'm experimenting with some alternate projections. I'm scratching my head a little trying to figure out the best way to make this work with modest maps, since the spherical mercator projection is hardcoded into the Map constructor. @tmcw or @shawnbot, if you were to add support for arbitrary projections, where would you do it? Would you have the Map object pick up the projection from the first layer it sees? Should it be possible to simply re-assign map.projection after an instance is created? I'm thinking it shouldn't and that picking up a projection from the first defined layer is the right way to go, and reassigning .projection is getting me some weird behaviors.
If you're curious, here's some sample code that I already know works on the server side in TileStache and I've verified that all the math is correct: https://gist.github.com/2691614
Hi,
I am confused as to which repository to follow\fork.. There is this one and then there is the other under stamen/modestmaps-js.
Which one is up to date or the main one?
Clarification on this would be highly appreciated.
-David.
Right now if you have a map with a 'base layer' and an 'overlay' and you have a function that sets a new overlay, you need a bit of code like
if (map.getLayers().length == 1) {
map.insertLayerAt(1, new layer());
} else {
map.setLayerAt(1, new layer());
}
I can't find a good example of the set/insert semantics anywhere else to reference, but it seems like this function should be more permissive and tolerate 'setting' layers at higher indices than are present.
setLayerAt doesn't insert DOM elements for layers in the correct spots - MM should enforce this, and tests for the layers API should confirm.
It'd be nice to promote the examples/
version of a keyboard control into core; it's pretty small code-wise and I often miss keyboard-nav.
Need to do a redo of the gh-pages branch when it gets moved here: https://github.com/sanborn/mm-ags
It would be nice to be able to choose between these behaviors:
Firefox and IE both gained 3d transforms support, which we should use in fastForward work. https://developer.mozilla.org/en/CSS/-moz-transform
I frequently see the first fetch of npm to get modestmaps fails (and its only mm that I see this for). Is there anything custom about the npm upload of MM that might be causing this? It ultimately succeeds as it appears npm retries, but I figured I should log an issue nevertheless in case something might need fixing:
Below output happens to be from windows, but I've seen this on OS X as well:
This a refactor that should happen; seeing approaches diverge at the grid level.
There appear to be no side-effects from doing this when cors is not available, and it's terribly useful when doing image manipulation (and there's no easy way to do this outside of modestmaps besides hacking the library or re-requesting tiles).
Would it be appropriate to add map.setPanLimits
? In a way, it would be the other half of map.setZoomRange
.
Something like:
setPanLimits: function(locations) {
if (locations instanceof MM.Extent) {
locations = locations.toArray();
}
this.coordLimits = [
locations[0].zoomTo(this.coordLimits[0].zoom),
locations[1].zoomTo(this.coordLimits[1].zoom)
];
return this;
}
We're running into problems with sparse tilesets in which a single 404 can block the removal of a parent tile, leading to the awful sustained-blurry-big tile problem. Should take a closer look at this code to come out with a better averaging of the two priorities:
This problem might lead to a solution for #16 as well.
Should modestmaps automatically set a reasonable zoom level for newly initialized maps? Or is this problematic when users will reset it quickly with .zoom()?
Take a look here:
You'll notice that the draw and zoom counter increments before the map is "ready for display"
from mapbox/mapbox.js#250
TouchHandler seems to be overagressive in handling events, and cancels touchstart/touchend that are useful for following links in on-map content.
As discussed with @tmcw, in IE8, the offsets get too big when viewing a map at high zoom level far away from the origin:
Background: https://support.laserfiche.com/kb/print/1012691
From stamen#131
Sparse tilesets have lots of 404s, and so pose two problems: parent tiles are not pulled out of the DOM when their children have failures, and 404 tiles themselves look weird.
This would be simple if we didn't consider IE7, which has 1-5% market share, so is barely worth considering.
Anyway,
The options are:
positionTile
The final option is
YUICompressor has done us well but many systems are shipping without Java, so its benefit of being installation-free is fading. A good option would be uglifyjs, with a fallback to google closure compiler on appspot for the no-install option.
var layer = mapbox.layer().id('jue.newyork-sample').disable();
new MM.Map('map', layer); // fail
Test case:
From MapBox Support 954
When loading the JS API into a "position: fixed" modal, if you scroll the page past the fold and then zoom in and out via mousewheel, the zoom center point is off zia the same distance the page has scrolled.
Using the code from the mouse position tutorial ( http://mapbox.com/mapbox.js/example/mouse-position/ ), when at the top of the document, the mouse y is 0 when at the top of the map container. The more you scroll down the page, position the cursor at the top of map container, it no longer reads 0, but an offset of how far the page has scrolled.
I've tried CSS position "static", "relative", "absolute" and widths and heights on the map container and it's parents, upto the modal container.
If looks like the zoom point is calculated via the mouse position on the document, not via the window. Is this a know issue or is there a fix?
When I try to run the modestmaps-static.js example I get the following stack trace:
/Users/christopherf/Documents/src/github/printlet/node_modules/modestmaps/examples/node/modestmaps-static.js:104
osm: new MM.TemplatedLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png")
^
TypeError: undefined is not a function
at Object.<anonymous> (/Users/christopherf/Documents/src/node_modules/modestmaps/examples/node/modestmaps-static.js:104:8)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I installed modestmaps version 3.3.5 with npm install modestmaps
on OSX 10.8.
I tried debugging with node-inspector and the MM
object doesn't look like the API described in the Wiki. Most importantly TemplatedLayer
dosen't exist, although I can find the declaration in the source file modestmaps.js
.
What am I doing wrong?
A behavior that I see a lot in projects is something like this:
var currentLayers = ['test'];
function buildMap() {
var map = new MM.Map('map');
map.addLayer(currentLayers)
}
document.getElementById('button').onclick = buildMap;
Excuse the psuedocode but the point should be clear: many users call MM.Map on the same element more than once. I think for defining the behavior of Modest Maps it's important to say what it should do here. Should new MM.Map return an existing map if one has been created that references that element? Or should it add multiple maps in the same container, with declared effects? Or throw an error?
I think the first - to return an existing map when re-called - would be the most 'user friendly' since it would also save some users from having to scope a map
variable specially in order to reference their maps. But maybe it's problematic in other ways?
This is necessary for layer types that want to subscribe to map events, and I don't think it's possible currently - needed by mmg.
The layer destroying code is all too eager about destroying code and indeed destroys our expectations about what happens when you have
var layer = blah();
map.addLayer(layer);
map.removeLayerAt(0);
map.addLayer(layer); // fail
See example: http://jsfiddle.net/gg3V4/ on large screen sizes, lat is restricted but the locationPoint function fails to take this into account.
While the homepage of http://modestmaps.com looks very promising having an example page like this
doesn't fill me with any confidence about investigating the app any further.
Is this a bug or coming soon?
@tristen has been doing some badass work on an MM examples site: http://tristen.ca/mm-examples/
This brings to a head one problem - that right now modestmaps.com is under stamen/modestmaps-js and we obviously can't fork into stamen, slash don't want to merge another subtree into gh-pages of modestmaps-js as is. So, sorry that it was a long annoying process to do modestmaps.com, but possibly it can be redirected to this organization? /cc @migurski @shawnbot
It should be possible to create a map without having a layer. Right now it fails.
ported: stamen#123
It'd be nice if the draw function off of map gave a list of tiles that it wanted to load, or there was another way of finding 'tiles needed at a certain extent/map size'. Mainly I want to start working on background tile loading and preloading for stuff like easey, and it wouldn't be terribly challenging if there was such an API. I'll see what this looks like specced out.
from stamen#56
As soon as chai gets its IE-support act together: chaijs/chai#117
we should switch to mocha. Until then, let's not doing it... since IE testing is what testing is.
The /test/browser path is unnecessary.
Hi, I'm wondering if anyone knows of a way to use setExtent
to get a more precise zoom level (with decimal value) as is possible with the mouse wheel handler. Thanks.
I think it would be useful to support layer names. This would allow the layer container divs to be named and styleable via outside CSS and is already supported by polymaps with its id option.
This would be a backwards-compatible new feature - a minor version bump. The bigger question is whether the layer accessor functions should be able to refer to layers by name and not just by index. Thoughts, @migurski & @shawnbot
MM.Layer is in-between being tile-specific and handling elements. I think it should slim down and there be alternative implementations.
The docs should list which callbacks are possible in Map.addCallback()
and removeCallback()
.
https://github.com/modestmaps/modestmaps-js/blob/master/src/layer.js#L280
The layer's element's css is copied over to the child when creating it. This is problematic when applying and then changing properties such as clip (see http://mapbox.com/mapbox.js/example/swipe-layers/). Should the properties be explicitly copied?
Hello !
Firstly, thanks for this awesome plugin. I'm using it with awesome Stamen tiles =)
I made all my construction, and my map is working well with easey (to make smooth moves).
But i cannot success placing markers/bubble on specific coordinate on map.
I tried:
var loc = new MM.Location({lat: -27, lon: 152});
var loc1 = new MM.Location(30, 114);
var point = { x: 10, y: 20 };
But still nothing on the map, i found something with MM.Follower but it not works to.
I'm simply trying to put BUBBLE on map (like in modestmaps example) or simple icon on a specific point. Thanks a lot !
In the latest tag, touch handlers seem to pan at 2x speed. There have not been any recent changes to touch.js so I can't track down the cause.
There are several references to TemplatedMapProvider remaining in modestmaps.js, including in the exports for node.js.
Not clear on whether setProvider provides any benefit over replacing a layer entirely.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.