Google Maps and draggable markers

216 views
Skip to first unread message

Johannes Fahrenkrug

unread,
Sep 7, 2009, 10:33:55 AM9/7/09
to Cappuccino & Objective-J
Hi!

I have a question. I'm using Ratty's MapKit framework which is - in
his own words - quite hacky (http://github.com/jfahrenkrug/MapKit/tree/
master). But it does the job pretty well. I can't get one thing to
work, though: draggable google maps markers. I've extended Ratty's
demo project here: http://github.com/jfahrenkrug/MapKit-HelloWorld/tree/master

It adds a draggable marker, but the problem is that it's not really
draggable. Does the CPView intercept the mouse events that the marker
should receive? Is there a way how I can get around that and make it
work?

I've already tried to set setAcceptsMouseMovedEvents:NO on the window,
but that didn't help either.

Oh, and here's a very simple demo of how it should actually work:
http://code.google.com/apis/maps/documentation/examples/marker-drag.html

Thank you so much!

- Johannes

--
http://blog.springenwerk.com

Jérôme Denanot

unread,
Sep 7, 2009, 12:40:46 PM9/7/09
to objec...@googlegroups.com
That looks a very interesting CP project !

2009/9/7 Johannes Fahrenkrug <jfahr...@gmail.com>

Francisco Tolmasky

unread,
Sep 8, 2009, 6:03:04 AM9/8/09
to Cappuccino & Objective-J
In MapView, try the following:

- (void)mouseDragged:(CPEvent)anEvent
{
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
}

- (void)mouseDown:(CPEvent)anEvent
{
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
}

- (void)mouseUp:(CPEvent)anEvent
{
[[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
}

I'm *not* sure if this will work with the current HTML 5 drag and drop
stuff (you may see the "whole world" drag). I will look more in depth
tomorrow morning.

On Sep 7, 9:40 am, Jérôme Denanot <jdena...@gmail.com> wrote:
> That looks a very interesting CP project !
>
> 2009/9/7 Johannes Fahrenkrug <jfahrenk...@gmail.com>

Johannes Fahrenkrug

unread,
Sep 8, 2009, 6:31:33 AM9/8/09
to Cappuccino & Objective-J
Hi Francisco,

Thank you for your reply, but this doesn't seem to help. Adding log
messages shows that these methods are not ever called.
Thank you for looking more in depth tomorrow!

- Johannes

Johannes Fahrenkrug

unread,
Sep 10, 2009, 5:17:22 AM9/10/09
to Cappuccino & Objective-J
Hi Francisco,

did you have a chance to look at this yet?

Thanks!

- Johannes

On Sep 8, 12:31 pm, Johannes Fahrenkrug <jfahrenk...@gmail.com> wrote:
> Hi Francisco,
>
> Thank you for your reply, but this doesn't seem to help. Adding log
> messages shows that these methods are not ever called.
> Thank you for looking more in depth tomorrow!
>
> - Johannes
>
> On Sep 8, 12:03 pm, Francisco Tolmasky <franci...@280north.com> wrote:
>
>
>
> > In MapView, try the following:
>
> > - (void)mouseDragged:(CPEvent)anEvent
> > {
> >     [[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
>
> > }
>
> > - (void)mouseDown:(CPEvent)anEvent
> > {
> >     [[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
>
> > }
>
> > - (void)mouseUp:(CPEvent)anEvent
> > {
> >     [[[self window] platformWindow] _propagateCurrentDOMEvent:YES];
>
> > }
>
> > I'm *not* sure if this will work with the current HTML 5 drag and drop
> > stuff (you may see the "whole world" drag). I will look more in depth
> > tomorrow morning.
>
> > On Sep 7, 9:40 am, Jérôme Denanot <jdena...@gmail.com> wrote:
>
> > > That looks a very interesting CP project !
>
> > > 2009/9/7 Johannes Fahrenkrug <jfahrenk...@gmail.com>
>
> > > > Hi!
>
> > > > I have a question. I'm using Ratty's MapKit framework which is - in
> > > > his own words - quite hacky (http://github.com/jfahrenkrug/MapKit/tree/
> > > > master). But it does the job pretty well. I can't get one thing to
> > > > work, though:draggablegoogle maps markers. I've extended Ratty's
> > > > It adds adraggablemarker, but the problem is that it's not really

Johannes Fahrenkrug

unread,
Sep 14, 2009, 2:28:58 AM9/14/09
to Cappuccino & Objective-J
I'm really sorry that I'm bugging you guys like this, but I'm working
on an urgent client project and if you could give me some pointers
about this sometime this week I'd be forever grateful :)

- Johannes

On Sep 10, 11:17 am, Johannes Fahrenkrug <jfahrenk...@gmail.com>

Tom Robinson

unread,
Sep 14, 2009, 2:45:46 AM9/14/09
to objec...@googlegroups.com
Try putting it in an iframe instead of directly in the application's
DOM (probably using CPWebView, with scrollbars disabled)

I've tried to get GMaps working in the DOM a couple times before with
limited success. Using an iframe should hopefully solve all the
problems.

-tom

Johannes Fahrenkrug

unread,
Sep 14, 2009, 12:44:19 PM9/14/09
to Cappuccino & Objective-J
Thanks for the tip, Tom!

Very, very rough around the edges, but draggable google maps markers
in cappuccino work: http://github.com/jfahrenkrug/MapKit-HelloWorld

- Johannes

Johannes Fahrenkrug

unread,
Sep 15, 2009, 4:22:03 AM9/15/09
to Cappuccino & Objective-J
Ok, I've cleaned it all up a bit:
http://github.com/jfahrenkrug/MapKit (with new README) and
http://github.com/jfahrenkrug/MapKit-HelloWorld

This will also show you how to get your CPWebView to resize
(hopefully) correctly.

- Johannes

John Fox

unread,
Sep 15, 2009, 11:41:15 AM9/15/09
to objec...@googlegroups.com
Hi Johannes:

This is a fantastic starting point. Many thanks for sharing this.

Best, 

John

---
John C. Fox 
Founder 
GroupSmarts, LLC 
MemoryMiner - "A world of stories..."





Reply all
Reply to author
Forward
0 new messages