MapMarker not binding

When trying to set MapMarker location via an Observable, the lat/long values of the marker are set to 0,0 (off the coast of Africa) instead of the correct values. MapMarkers work fine when lat/long are explicitly defined in UX.

This works:

<MapMarker Latitude="30.217947" Longitude="-97.796168" Label="ME!"/>

but this does not:

<MapMarker Latitude="{markerLatitude}" Longitude="{markerLongitude}" Label="ME!"/>

In this example I have a function called dropPin which sets the markerLatitude and markerLongitude values to the current lat/long of the MapView.

<App Theme="Basic">
    <JavaScript>
        var Observable = require('FuseJS/Observable'),
            geo = require('FuseJS/GeoLocation'),
            latitude = Observable(),
            longitude = Observable(),
            accuracy = Observable(),
            markerLatitude = Observable(),
            markerLongitude = Observable(),
            zoom = Observable(500); // default zoom for ios
        var currentLat = 0,
            currentLong = 0;

        if (geo.location != null) {
            var location = geo.location;

            // save and set current location
            currentLat = latitude.value = location.latitude;
            currentLong = longitude.value = location.longitude;

            // set marker to current position
            markerLatitude.value = currentLat;
            markerLongitude.value = currentLong;

            debug_log('markerLat: ' + markerLatitude.value);
            debug_log('markerLong: ' + markerLongitude.value);

            accuracy.value = location.accuracy;
        }

        var resetView = function(args) {
            latitude.value = currentLat;
            longitude.value = currentLong;
            zoom.value = 500;
        }

        var dropPin = function(args) {
            // set marker to current map location
            markerLatitude.value = latitude.value;
            markerLongitude.value = longitude.value;

            debug_log(markerLatitude.value);
            debug_log(markerLongitude.value);
        }

        module.exports = {
            latitude:latitude,
            longitude:longitude,
            accuracy: accuracy,
            zoom: zoom,
            markerLatitude: markerLatitude,
            markerLongitude: markerLongitude,

            // functions
            resetView: resetView,
            dropPin: dropPin
        }
    </JavaScript>
    <DockPanel>
        <Panel>
            <NativeViewHost>
                <MapView Zoom="{zoom}" Latitude="{latitude}" Longitude="{longitude}">
                    <MapMarker Latitude="{markerLatitude}" Longitude="{markerLongitude}" Label="ME!"/>
                    <!-- <MapMarker Latitude="30.217947" Longitude="-97.796168" Label="ME!"/> -->
                </MapView>
            </NativeViewHost>
        </Panel>
        <StackPanel Dock="Bottom" Height="100">
            <Text Value="{latitude}" />
            <Text Value="{longitude}" />
            <StackPanel Orientation="Horizontal">
                <Button Text="Reset" Clicked="{resetView}" />
                <Button Text="Drop Pin" Clicked="{dropPin}" />            </StackPanel>
        </StackPanel>
    </DockPanel>
</App>

Thank you in advance!

Hey Patrick, this exact thing was something we thought we fixed in the previous release. Which version are you on?

I’m running 0.11 latest

Thanks Patrick, you’ve uncovered a nasty bug. A fix has been committed and will make it into a release soon.