Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a GoogleMap control to the Ooui project and added a Ooui.Forms.Maps project to support it #160

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BOTLANNER
Copy link

Ooui Project

  • Extended functionality to support DOM custom events with JSON objects as content for interop between javascript and the C# code (this was required in order to interact with the GoogleMap control scripts)
  • Added a GoogleMap control to the Ooui project with a sample.

Ooui.Forms.Maps Project (NEW)

  • Added a Ooui.Forms.Maps project to support the GoogleMap control for Xamarin Forms integration (also with a sample).

The Ooui.Forms.Maps is a separate project from Ooui.Forms, because Xamarin.Forms.Maps is separate from Xamarin.Forms, and it would be unnecessary for Ooui.Forms to have a dependency on the maps project if it is not part of the default package. If this is used as a separate project, it would probably need to become its own nuget package as well.

Samples Project

  • Added a plain web sample for Maps
  • Added a Xamarin sample for Maps

The resulting control looks like the below (depending on Map Type option, etc):
image

- Modified Client.js (ooui.js) to support raising and listening to custom events
@praeclarum
Copy link
Owner

Oh, good another nuget haha ;-)

This is great work, thank you. I want to review it before merging.

I'm not sold on the separate nuget... what is the actual benefit?

@BOTLANNER
Copy link
Author

It does not need to be a separate nuget, but to keep consistent with how Xamarin manages their components it would make sense to follow the same approach. Especially since combining the projects would mean that any user of Ooui forms will have a possible unnecessary dependency on Xamarin.Forms.Maps even though they may not need to use maps, this would lighten the requirements for the base Ooui.Forms (but also increase it to an additional package for users who do want to use maps).

@praeclarum
Copy link
Owner

I was just reviewing the code and saw that your tore up the event system.

Can you explain why? What feature wasn't available that required all these changes?

@BOTLANNER
Copy link
Author

I needed to be able to pass and receive full JSON objects that map to classes on the GoogleMaps control, and the event system only allowed for TargetEventHandler which was hardcoded to expect

public class TargetEventArgs : EventArgs { public double OffsetX { get; set; } public double OffsetY { get; set; } }
and so I had to create the DOMEventHandler which allowed for

public class DOMEventArgs : EventArgs { public Newtonsoft.Json.Linq.JObject Data { get; set; } }
in the callback. That way I could access the custom event data that had been passed from the javascript. For instance with the retrieval of the map center:

pos = new Position { latitude = (double)e.Data["latitude"], longitude = (double)e.Data["longitude"], };

@adelinmaubray
Copy link

It would be cool if this request was accepted 😎

KevinGliewe added a commit to KevinGliewe/Goui that referenced this pull request Sep 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants