Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

leafletDraw #184

Conversation

nmccready
Copy link
Contributor

Don't merge this yet. It is mainly to start getting eyes on this.

Still needs:

  • more specs
  • examples
  • documentation

Can make an additional PR as this is 37 files already.

@@ -9,7 +9,7 @@ root = true

# Change these settings to your own preference
indent_style = space
indent_size = 4
indent_size = 2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start using 2 space indent. I'll fix it as I go; or I can do all the files in another follow up PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Editors tend to pick what's around, so it might be good idea to do one massive PR instead of leaving mixed styles behind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id rather not do all of it right now as it makes it even harder to review. Ill do it immediately after this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, absolutely, indentation PR has to have only spaces changed and nothing else.

We had this with Meanjs and it was good to watch for a moment with minimum amount of PR's pending.

@nmccready
Copy link
Contributor Author

@jessertaylor @elesdoar @simison

This was referenced Nov 7, 2015
@nmccready nmccready modified the milestones: 1.0.1 (angular-leaflet-directive 0.9.1), 1.1.0 (angular-leaflet-directive 0.10.0) Nov 7, 2015
@elesdoar
Copy link
Contributor

elesdoar commented Nov 7, 2015

should this PR be on leaflet-1.X branch? We talk about plugins for version 2, no?

@elesdoar
Copy link
Contributor

elesdoar commented Nov 7, 2015

On the another hand, I like this changes, 👍

angular.module('ui-leaflet')
.factory('leafletDrawEvents', function(leafletEventsHelpersFactory) {

class DrawEvents extends leafletEventsHelpersFactory{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I thought the Babel compiled code to this was quite comical. As people who hate CoffeeScript babel's output is way way harder to read. I almost would rather revert this to ES5.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vs

angular.module('ui-leaflet')
.factory 'leafletDrawEvents', (leafletEventsHelpersFactory) ->

  class DrawEvents extends leafletEventsHelpersFactory
    constructor: () ->
      super('leafletDirectiveDraw', 'draw')


    getAvailableEvents: () ->
      return [
        'created'
        'edited'
        'deleted'
        'drawstart'
        'drawstop'
        'editstart'
        'editstop'
        'deletestart'
        'deletestop'].map (n) -> 
          return 'draw:' + n

    new DrawEvents()

yeilds:

var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  hasProp = {}.hasOwnProperty;

angular.module('ui-leaflet').factory('leafletDrawEvents', function(leafletEventsHelpersFactory) {
  var DrawEvents;
  return DrawEvents = (function(superClass) {
    extend(DrawEvents, superClass);

    function DrawEvents() {
      DrawEvents.__super__.constructor.call(this, 'leafletDirectiveDraw', 'draw');
    }

    DrawEvents.prototype.getAvailableEvents = function() {
      return ['created', 'edited', 'deleted', 'drawstart', 'drawstop', 'editstart', 'editstop', 'deletestart', 'deletestop'].map(function(n) {
        return 'draw:' + n;
      });
    };

    new DrawEvents();

    return DrawEvents;

  })(leafletEventsHelpersFactory);
});

// ---
// generated by coffee-script 1.9.2

@nmccready
Copy link
Contributor Author

@elesdoar no, I need these changes now for work. Plus this is backwards compatible but done in a more modular way. I plan on switching the other directives to be like this as well with the angular.config.

@@ -9,6 +9,11 @@
"type": "git",
"url": "https://github.com/angular-ui/ui-leaflet"
},
"scripts": {
"test": "grunt travis --verbose",
"karma": "karma start ./test/karma.conf.js"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note besides grunt karma you can run npm run karma now.

@nmccready
Copy link
Contributor Author

I plan on having a follow up PR for documentation and more specs. As well as fixing directiveControls, and leafletData.

@nmccready
Copy link
Contributor Author

@elesdoar your right, I will put all the leaflet draw stuff into a sep repo. This PR will become just karma, grunt, and babel fixes.

@nmccready
Copy link
Contributor Author

Closing for plugin / component repo for ui-leaflet-draw.

https://github.com/angular-ui/ui-leaflet-draw

@nmccready nmccready closed this Nov 9, 2015
@nmccready nmccready deleted the dev/nmccready/issue_105_leaflet_draw branch November 9, 2015 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants