Giter Site home page Giter Site logo

ngeoDecorate*: two way binding ? about ngeo HOT 8 CLOSED

fredj avatar fredj commented on May 21, 2024
ngeoDecorate*: two way binding ?

from ngeo.

Comments (8)

elemoine avatar elemoine commented on May 21, 2024

Yes why not. Do you have a specific use-case in mind?

from ngeo.

fgravin avatar fgravin commented on May 21, 2024

We can do it with handling some ol events maybe, but take care of infinite loop !

from ngeo.

fredj avatar fredj commented on May 21, 2024

Yes why not. Do you have a specific use-case in mind?

A ngeoDecorateView for example

from ngeo.

elemoine avatar elemoine commented on May 21, 2024

Yes why not. Do you have a specific use-case in mind?

A ngeoDecorateView for example

I was wondering about an application use-case.

Also, we could extend the ngeoDecorateGeolocation service to add a position property to the passed ol.Geolocation instance. This would also require binding in the other direction (ol3 -> angular).

I'd rather wait for specific use-cases before implementing this though, this is why I was asking if you had any.

from ngeo.

fredj avatar fredj commented on May 21, 2024

I was wondering about an application use-case.

Display the view rotation in a text element:

<span>{{view.rotation}}</span>

from ngeo.

elemoine avatar elemoine commented on May 21, 2024

Ok.

Note that for view.center we'd need some debouncing, not to incur a digest cycle on each frame (when the map is panned or animates). We introduced an ngeoDebounce service that could be used there as well.

from ngeo.

elemoine avatar elemoine commented on May 21, 2024

@fredj, I guess making this work would just require triggering a digest cycle when the ol3 property changes. For example, this is what the ngeoDecorateLayer would do for the visible property:

    goog.events.listen(layer, ol.Object.getChangeEventType('visible'),
        /**
         * @type {ol.ObjectEvent} e Object event.
         */
        function(e) {
            $rootScope.$digest();
        }, false, this);

As I said, we'd need to be careful for the view center, because we don't want to trigger a digest every time the center changes while dragging the map.

What we could possibly do is add a boolean option/argument to the ngeoDecorate* functions.

from ngeo.

elemoine avatar elemoine commented on May 21, 2024

Closing this for now.

from ngeo.

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.