Skip to content

Commit ce64660

Browse files
authored
Add scrollWheel zooming functionality switch to Google Point Widget (#135)
* Add scroll-wheel zooming functionality switch to Google point widget settings * Added Chinese(ZH) localization files. #133 * update readme files with new version release notes
1 parent e533fb1 commit ce64660

File tree

12 files changed

+101
-21
lines changed

12 files changed

+101
-21
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ This widget is working with <a href="http://dimsemenov.com/plugins/magnific-popu
103103

104104
### Release Notes
105105

106+
#### 0.4.1
107+
> - Added scroll wheel zooming functionality switch to Google Point Map Settings. (#134)
108+
> - Added Chinese(ZH) localisation support. (#133)
109+
106110
#### 0.4.0
107111
> - Supported MapBox Map for Django Geo Point Field.
108112
> - Fixed undefined place object binding issue in javascript triggers. (#125)

README.rst

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
.. image:: https://coveralls.io/repos/github/erdem/django-map-widgets/badge.svg?branch=master
2-
:target: https://coveralls.io/github/erdem/django-map-widgets?branch=master
3-
:alt: Coverage Status
4-
5-
.. image:: https://travis-ci.org/erdem/django-map-widgets.png
6-
:target: https://travis-ci.org/erdem/django-map-widgets
7-
:alt: Build Status
8-
9-
.. image:: https://badge.fury.io/py/django-map-widgets.svg
10-
:target: https://badge.fury.io/py/django-map-widgets
11-
:alt: Latest PyPI version
12-
131
Django Map Widgets
142
==================
153

@@ -105,6 +93,13 @@ Google Map Static Overlay Widget
10593
Release Notes
10694
^^^^^^^^^^^^^
10795

96+
=====
97+
0.4.1
98+
=====
99+
100+
* Added scroll wheel zooming functionality switch to Google Point Map Settings. (#134)
101+
* Added Chinese(ZH) localisation support. (#133)
102+
108103
=====
109104
0.4.0
110105
=====

demo/demo/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
SITE_PATH = os.path.abspath(os.path.dirname(__file__))
2020
PROJECT_PATH = os.path.normpath(os.path.join(SITE_PATH, '..', '..'))
21-
if PROJECT_PATH not in sys.path:
22-
sys.path.insert(0, PROJECT_PATH)
21+
# if PROJECT_PATH not in sys.path:
22+
# sys.path.insert(0, PROJECT_PATH)
2323

2424

2525
# Quick-start development settings - unsuitable for production
@@ -148,7 +148,8 @@
148148
("mapCenterLocation", [51.5073509, -0.12775829999998223]),
149149
("markerFitZoom", 11),
150150
("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'uk'}}),
151-
("streetViewControl", False)
151+
("streetViewControl", False),
152+
("scrollWheel", True)
152153
),
153154
"MapboxPointFieldWidget": {
154155
"access_token": MAPBOX_API_KEY,
@@ -159,4 +160,3 @@
159160
},
160161
"GOOGLE_MAP_API_KEY": GOOGLE_MAP_API_KEY
161162
}
162-

docs/widgets/google_point_field_map_widgets.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Settings
4242

4343
* **zoom** : Default zoom value for maps (optional, default value is 6).
4444

45+
* **scrollWheel** : Enables or Disables zooming on the map using a mouse scroll wheel. Set as `True` in your django settings to enable it, the scroll wheel zooming is disabled by default.
46+
4547
* **markerFitZoom** : When the marker is initialized google's default zoom is set to Max. This method sets the zoom level a reasonable distance and center the marker on the map.
4648

4749
* **streetViewControl** : Whether or not to display the Street View "Peg Man" (optional, default is ``True``). Setting this to ``False`` effectively disables Street View for the widget.
@@ -61,6 +63,7 @@ In your ``settings.py`` file, add your ``MAP_WIDGETS`` config:
6163
("mapCenterLocationName", "london"),
6264
("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'uk'}}),
6365
("markerFitZoom", 12),
66+
("scrollWheel", False),
6467
("streetViewControl", True),
6568
),
6669
"GOOGLE_MAP_API_KEY": "<google-api-key>"
778 Bytes
Binary file not shown.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3+
# This file is distributed under the same license as the PACKAGE package.
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
# Source: https://github.com/erdem/django-map-widgets/pull/133
8+
msgid ""
9+
msgstr ""
10+
"Project-Id-Version: PACKAGE VERSION\n"
11+
"Report-Msgid-Bugs-To: \n"
12+
"POT-Creation-Date: 2022-07-29 15:23-0500\n"
13+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15+
"Language-Team: LANGUAGE <[email protected]>\n"
16+
"Language: \n"
17+
"MIME-Version: 1.0\n"
18+
"Content-Type: text/plain; charset=UTF-8\n"
19+
"Content-Transfer-Encoding: 8bit\n"
20+
21+
#: settings.py:85 settings.py:95
22+
msgid "MapWidget settings must be a tuple or dictionary"
23+
msgstr ""
24+
25+
#: settings.py:114 settings.py:136
26+
#, python-format
27+
msgid ""
28+
"Invalid %s settings value. Please check the settings documentation http://"
29+
"django-map-widgets.readthedocs.io/en/latest/widgets/settings.html"
30+
msgstr ""
31+
32+
#: templates/mapwidgets/google-point-field-widget.html:8
33+
#: templates/mapwidgets/mapbox-point-field-widget.html:8
34+
msgid "Edit coordinates"
35+
msgstr "修改坐标"
36+
37+
#: templates/mapwidgets/google-point-field-widget.html:11
38+
#: templates/mapwidgets/mapbox-point-field-widget.html:11
39+
msgid "Latitude:"
40+
msgstr "纬度"
41+
42+
#: templates/mapwidgets/google-point-field-widget.html:12
43+
#: templates/mapwidgets/mapbox-point-field-widget.html:12
44+
msgid "Ex: 41.015137"
45+
msgstr "如:41.015137"
46+
47+
#: templates/mapwidgets/google-point-field-widget.html:15
48+
#: templates/mapwidgets/mapbox-point-field-widget.html:15
49+
msgid "Longitude:"
50+
msgstr "经度"
51+
52+
#: templates/mapwidgets/google-point-field-widget.html:16
53+
#: templates/mapwidgets/mapbox-point-field-widget.html:16
54+
msgid "Ex: 28.979530"
55+
msgstr "如:28.979530"
56+
57+
#: templates/mapwidgets/google-point-field-widget.html:18
58+
#: templates/mapwidgets/mapbox-point-field-widget.html:18
59+
msgid "Done"
60+
msgstr "完成"
61+
62+
#: templates/mapwidgets/google-point-field-widget.html:22
63+
#: templates/mapwidgets/mapbox-point-field-widget.html:22
64+
msgid "Use My Location"
65+
msgstr "使用当前位置"
66+
67+
#: templates/mapwidgets/google-point-field-widget.html:23
68+
#: templates/mapwidgets/mapbox-point-field-widget.html:23
69+
msgid "Choose point on map"
70+
msgstr "在地图上标注"
71+
72+
#: templates/mapwidgets/google-point-field-widget.html:25
73+
#: templates/mapwidgets/mapbox-point-field-widget.html:64
74+
msgid "Find a Location by Address"
75+
msgstr "输入地址查找"

mapwidgets/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
("mapCenterLocationName", None),
1111
("mapCenterLocation", TIMEZONE_COORDINATES.get(getattr(django_settings, "TIME_ZONE", "UTC"))),
1212
("zoom", 12),
13+
("scrollWheel", False),
1314
("GooglePlaceAutocompleteOptions", {}),
1415
("markerFitZoom", 14),
1516
("streetViewControl", True),

mapwidgets/static/mapwidgets/js/mw_google_point_field.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
this.map = new google.maps.Map(this.mapElement, {
1414
center: new google.maps.LatLng(mapCenter[0], mapCenter[1]),
15-
scrollwheel: false,
15+
scrollwheel: this.scrollWheel,
1616
zoomControlOptions: {
1717
position: google.maps.ControlPosition.RIGHT
1818
},
@@ -31,7 +31,7 @@
3131
}else{
3232
this.map = new google.maps.Map(this.mapElement, {
3333
center: new google.maps.LatLng(mapCenter[0], mapCenter[1]),
34-
scrollwheel: false,
34+
scrollwheel: this.scrollWheel,
3535
zoomControlOptions: {
3636
position: google.maps.ControlPosition.RIGHT
3737
},

mapwidgets/templates/mapwidgets/google-point-field-inline-widget.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
addMarkerBtn: $(".mw-btn-add-marker", wrapElemSelector),
3232
loaderOverlayElem: $(".mw-loader-overlay", wrapElemSelector),
3333
zoom: mapOptions.zoom,
34+
scrollWheel: mapOptions.scrollWheel,
3435
markerFitZoom: mapOptions.markerFitZoom,
3536
GooglePlaceAutocompleteOptions: mapOptions.GooglePlaceAutocompleteOptions,
3637
markerCreateTriggerNameSpace: "google_point_map_widget:marker_create",

mapwidgets/templates/mapwidgets/google-point-field-widget.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
deleteBtn: $(".mw-btn-delete", wrapElemSelector),
7676
addMarkerBtn: $(".mw-btn-add-marker", wrapElemSelector),
7777
loaderOverlayElem: $(".mw-loader-overlay", wrapElemSelector),
78+
scrollWheel: mapOptions.scrollWheel,
7879
zoom: mapOptions.zoom,
7980
markerFitZoom: mapOptions.markerFitZoom,
8081
GooglePlaceAutocompleteOptions: mapOptions.GooglePlaceAutocompleteOptions,

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[metadata]
2-
license-file = LICENSE
3-
description-file = README.md
2+
license_file = LICENSE
3+
description_file = README.md

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from setuptools import setup, find_packages
22

3-
VERSION = (0, 4, 0)
3+
VERSION = (0, 4, 1)
44
__version__ = '.'.join(map(str, VERSION))
55

66

0 commit comments

Comments
 (0)