Skip to content

Commit 08571ce

Browse files
committed
Use default center only if no default lat/lng values are set, do not trigger the field update on map init
1 parent 45bb6f1 commit 08571ce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

client/js/GoogleMapField.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242

4343
mapSettings.coords = [latCoord, lngCoord];
4444

45-
latField.val(latCoord);
46-
lngField.val(lngCoord);
4745
updateBounds(init);
4846

4947
// Mark form as changed if this isn't initialisation
5048
if (!init) {
49+
latField.val(latCoord);
50+
lngField.val(lngCoord);
5151
$('.cms-edit-form').addClass('changed');
5252
}
5353
}

src/GoogleMapField.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ public function Field($properties = array()) {
156156
$this->recordFieldData('Longitude')
157157
),
158158
'center' => array(
159-
$this->getLatData() ?: $this->getOption('center.Latitude'),
160-
$this->getLngData() ?: $this->getOption('center.Longitude'),
159+
$this->recordFieldData('Latitude') ?: $this->getOption('center.Latitude'),
160+
$this->recordFieldData('Longitude') ?: $this->getOption('center.Longitude'),
161161
),
162162
'map' => array(
163163
'zoom' => $this->recordFieldData('Zoom') ?: $this->getOption('map.zoom'),

0 commit comments

Comments
 (0)