Eric Boehlke
Eric Boehlke

Reputation: 81

Meteor's example Party app on mobile browser?

I am hacking the Meteor's example Party app, and trying to use it on a mobile browser. The dblclick does not seem to mean anything in a touch environment (I'm testing it with Chrome for Android). Does anyone know of an alternative coding in this context to differentiate between clicking on an event's circle icon and creating a new event on the map (currently dblclick)?

This is the problematic part of client.js :

Template.map.events({
  'mousedown circle, mousedown text': function (event, template) {
    Session.set("selected", event.currentTarget.id);
  },
  'dblclick .map': function (event, template) {
    if (! Meteor.userId()) // must be logged in to create events
      return;
    var coords = coordsRelativeToElement(event.currentTarget, event);
    openCreateDialog(coords.x / 500, coords.y / 500);
  }
});

Upvotes: 1

Views: 426

Answers (3)

George 2.0 Hope
George 2.0 Hope

Reputation: 648

The old Meteor.JS Parties example is no longer available; so unless you've an updated link to it (which I couldn't find) I can't talk specifics. However, here's what I suggest:

Download this version of the Parties example: https://github.com/pkaushik/parties

Update the meteor packages: meteor update --all-packages

Update the [server/accounts.js] file to use local host for OAuth, or your own GitHub OAuth info.

Start the MeteorJS app & browse to localhost (must be localhost).

(Note: there's a slight "hack" necessary to "authenticate" when using localhost; because localhost isn't your android phone. When you [LogIn] the webapp will redirect you to localhost/<[a long OAuth string here]> ... you just need to manually edit the 'redirected' url to the local IP of the server i.e. 10.10.10.13/<[a long OAuth string here]>.)

On my phone (HTC M8 One), using Android (6.0) & Google Chrome (v53.0.2785.124) the double tap for this app works fine.

Upvotes: 1

Hubert OG
Hubert OG

Reputation: 19544

You may try replacing double click with long press / long tap event.

Upvotes: 2

mjkaufer
mjkaufer

Reputation: 4206

Click events work horribly on mobile devices. You'll probably want to look into a Javascript library. jQuery mobile supports tap events, but not double tap events as you'd like. Here's a library which does. https://github.com/benmajor/jQuery-Mobile-Events Good luck.

Upvotes: 1

Related Questions