Skip to content

Commit

Permalink
update(fillInAddress-block)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledN committed Oct 20, 2015
1 parent 97abea4 commit daabc94
Showing 1 changed file with 38 additions and 34 deletions.
72 changes: 38 additions & 34 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,44 +712,48 @@

if (indexOfMarker < 0) indexOfMarker = appendMarker($Self.map.markers, $Self['model']);

$Self.map.panTo($Position);

// Drop pin
if(!$Self.map.markers[indexOfMarker]['marker']) {
$Self.map.markers[indexOfMarker]['marker'] = GetMarker({
animation: google.maps.Animation.DROP,
map: $Self.map,
lat: lat,
lng: lng,
label: $Self['markerlabel'] || Characters[indexOfMarker],
try {
$Self.map.panTo($Position);

// Drop pin
if(!$Self.map.markers[indexOfMarker]['marker']) {
$Self.map.markers[indexOfMarker]['marker'] = GetMarker({
animation: google.maps.Animation.DROP,
map: $Self.map,
lat: lat,
lng: lng,
label: $Self['markerlabel'] || Characters[indexOfMarker],
});
} else {
$Self.map.markers[indexOfMarker]['marker'].setMap($Self.map);
$Self.map.markers[indexOfMarker]['marker'].setPosition({
lat: lat,
lng: lng
});
}

var $Marker = $Self.map.markers[indexOfMarker]['marker'];

$Marker.addListener('dragend', function($Event) {
if(typeof $Self.ondrop == 'function') $Self.ondrop({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});
} else {
$Self.map.markers[indexOfMarker]['marker'].setMap($Self.map);
$Self.map.markers[indexOfMarker]['marker'].setPosition({
lat: lat,
lng: lng
});
}

var $Marker = $Self.map.markers[indexOfMarker]['marker'];

$Marker.addListener('dragend', function($Event) {
if(typeof $Self.ondrop == 'function') $Self.ondrop({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});
$Marker.addListener('dragstart', function($Event) {
if(typeof $Self.ondragstart == 'function') $Self.ondragstart({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});
$Marker.addListener('click', function($Event) {
if (typeof $Self.onmarkerclick == 'function') $Self.onmarkerclick({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});

// Push a new marker into markers list
appendMarker($Self.map.markers, $Self.model);
$Marker.addListener('dragstart', function($Event) {
if(typeof $Self.ondragstart == 'function') $Self.ondragstart({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});

$Marker.addListener('click', function($Event) {
if (typeof $Self.onmarkerclick == 'function') $Self.onmarkerclick({$Event: $Event, $Model: $Self.model, $AutoCompScope: $Self, $Marker: this});
});

// Push a new marker into markers list
appendMarker($Self.map.markers, $Self.model);
} catch (error) {
console.log(error.message);
}

if(typeof $Self.onfill == 'function') $Self.onfill({$Position: $Position, $Model: $Self.model, $CoreModel: place, $Element: $Self.element, $Marker: $Marker});


}

Expand Down

0 comments on commit daabc94

Please sign in to comment.