GithubHelp home page GithubHelp logo

Comments (5)

RandomEtc avatar RandomEtc commented on July 29, 2024

It was my expectation when writing the first version of Modest Maps JS that people would have their own opinions on interaction (and indeed they do). (Over in Polymaps land there's a debate about whether the mousewheel should pan or zoom!). Even the default mouse handler is optional, and there are examples for smooth zooming and touch events already. I imagine a click/double-click handler could work the same way. I'd like to see this kind of functionality implemented as an example first and then moved to "core" functionality later.

Cross-browser click vs double-click (and tap vs double-tap) is tricky. I note you're using jQuery there, I'm surprised it doesn't handle it already but the docs even suggest that you don't use both single click and double click on the same element! http://api.jquery.com/dblclick/ (bit of a cop-out, no?) The comments offer this solution, which counts single clicks and chooses one of two callbacks: https://gist.github.com/399624 and the comments on that offer a double-click fix for IE which already (sometimes) suppresses click events if there's a fast double click (I think).

Modest Maps JS already includes some rough and ready DOM event handlers (MM.addEvent etc) to smooth things out for cross browser events (tidying up window.event, mousewheel, canceling events, etc). It seems useful to expose this functionality in addCallback for DOM events, or perhaps to promote certain DOM events into map callbacks (click, drag, wheel, etc.). I filed issue #10 for another similar request... there's no formal roadmap or milestones in play though, so it might be some time before it gets added.

(As an aside I don't know anyone using using Modest Maps JS and not using jQuery. I imagine the library could be cleaned up and compacted quite a bit if we created a jQuery fork of it. Food for thought?)

from modestmaps-js.

RandomEtc avatar RandomEtc commented on July 29, 2024

Perhaps this would be a more useful contribution to a mini library like https://github.com/fat/bean (and perhaps Modest Maps could liberally borrow or utilise http://dustindiaz.com/ender ?)

from modestmaps-js.

tmcw avatar tmcw commented on July 29, 2024

Yep, I was going to file an issue about possibly moving some things into jQuery, but decided to throttle my flood of this issue tracker :).

I think it'd be awesome to switch some of the essentials over to jQuery. It'd also be interesting to think about using a micro-library, since it seems like starting from scratch is giving some projects the ability to do things smaller and cleaner, but that'd be less of a win for people who, as you note, are all using jQuery. A cautionary example in OpenLayers which contains bits of Rico...

And it's surprising that even jQuery doesn't have a good implementation of click/doubleclick built in - they don't seem opposed to creating new pseudoevents and stuff like that. I can ask about that over on jQuery's site?

from modestmaps-js.

RandomEtc avatar RandomEtc commented on July 29, 2024

The usual reason for missing jQuery functionality is that it can't be done perfectly consistently on all browsers. It's a worry! But for the case of click/double-click it's a bit weird. Basically you need to have a ~250ms delay on all click events where there's also a double-click listener in place. I can imagine that's a controversial thing - it's just as easy to delay the click response and cancel it on double click, and then the behaviour is controlled at the application level not the library level.

I'm pretty sure Shawn at Stamen would also be interested in a modest maps jquery fork, I remember he asked after it a while ago. And it would probably get more contributions because people are more familiar and hack-happy with jquery.

from modestmaps-js.

tmcw avatar tmcw commented on July 29, 2024

Closing; this is out of scope for Modest Maps IMH(current)O.

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.