Skip to content

Commit

Permalink
Add scrollWheel zooming functionality switch to Google Point Widget (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
erdem authored Dec 21, 2022
1 parent e533fb1 commit ce64660
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 21 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ This widget is working with <a href="http://dimsemenov.com/plugins/magnific-popu

### Release Notes

#### 0.4.1
> - Added scroll wheel zooming functionality switch to Google Point Map Settings. (#134)
> - Added Chinese(ZH) localisation support. (#133)
#### 0.4.0
> - Supported MapBox Map for Django Geo Point Field.
> - Fixed undefined place object binding issue in javascript triggers. (#125)
Expand Down
19 changes: 7 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
.. image:: https://coveralls.io/repos/github/erdem/django-map-widgets/badge.svg?branch=master
:target: https://coveralls.io/github/erdem/django-map-widgets?branch=master
:alt: Coverage Status

.. image:: https://travis-ci.org/erdem/django-map-widgets.png
:target: https://travis-ci.org/erdem/django-map-widgets
:alt: Build Status

.. image:: https://badge.fury.io/py/django-map-widgets.svg
:target: https://badge.fury.io/py/django-map-widgets
:alt: Latest PyPI version

Django Map Widgets
==================

Expand Down Expand Up @@ -105,6 +93,13 @@ Google Map Static Overlay Widget
Release Notes
^^^^^^^^^^^^^

=====
0.4.1
=====

* Added scroll wheel zooming functionality switch to Google Point Map Settings. (#134)
* Added Chinese(ZH) localisation support. (#133)

=====
0.4.0
=====
Expand Down
8 changes: 4 additions & 4 deletions demo/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

SITE_PATH = os.path.abspath(os.path.dirname(__file__))
PROJECT_PATH = os.path.normpath(os.path.join(SITE_PATH, '..', '..'))
if PROJECT_PATH not in sys.path:
sys.path.insert(0, PROJECT_PATH)
# if PROJECT_PATH not in sys.path:
# sys.path.insert(0, PROJECT_PATH)


# Quick-start development settings - unsuitable for production
Expand Down Expand Up @@ -148,7 +148,8 @@
("mapCenterLocation", [51.5073509, -0.12775829999998223]),
("markerFitZoom", 11),
("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'uk'}}),
("streetViewControl", False)
("streetViewControl", False),
("scrollWheel", True)
),
"MapboxPointFieldWidget": {
"access_token": MAPBOX_API_KEY,
Expand All @@ -159,4 +160,3 @@
},
"GOOGLE_MAP_API_KEY": GOOGLE_MAP_API_KEY
}

3 changes: 3 additions & 0 deletions docs/widgets/google_point_field_map_widgets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Settings

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

* **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.

* **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.

* **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.
Expand All @@ -61,6 +63,7 @@ In your ``settings.py`` file, add your ``MAP_WIDGETS`` config:
("mapCenterLocationName", "london"),
("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'uk'}}),
("markerFitZoom", 12),
("scrollWheel", False),
("streetViewControl", True),
),
"GOOGLE_MAP_API_KEY": "<google-api-key>"
Expand Down
Binary file added mapwidgets/locale/zh/LC_MESSAGES/django.mo
Binary file not shown.
75 changes: 75 additions & 0 deletions mapwidgets/locale/zh/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
# Source: https://github.com/erdem/django-map-widgets/pull/133
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-07-29 15:23-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: settings.py:85 settings.py:95
msgid "MapWidget settings must be a tuple or dictionary"
msgstr ""

#: settings.py:114 settings.py:136
#, python-format
msgid ""
"Invalid %s settings value. Please check the settings documentation http://"
"django-map-widgets.readthedocs.io/en/latest/widgets/settings.html"
msgstr ""

#: templates/mapwidgets/google-point-field-widget.html:8
#: templates/mapwidgets/mapbox-point-field-widget.html:8
msgid "Edit coordinates"
msgstr "修改坐标"

#: templates/mapwidgets/google-point-field-widget.html:11
#: templates/mapwidgets/mapbox-point-field-widget.html:11
msgid "Latitude:"
msgstr "纬度"

#: templates/mapwidgets/google-point-field-widget.html:12
#: templates/mapwidgets/mapbox-point-field-widget.html:12
msgid "Ex: 41.015137"
msgstr "如:41.015137"

#: templates/mapwidgets/google-point-field-widget.html:15
#: templates/mapwidgets/mapbox-point-field-widget.html:15
msgid "Longitude:"
msgstr "经度"

#: templates/mapwidgets/google-point-field-widget.html:16
#: templates/mapwidgets/mapbox-point-field-widget.html:16
msgid "Ex: 28.979530"
msgstr "如:28.979530"

#: templates/mapwidgets/google-point-field-widget.html:18
#: templates/mapwidgets/mapbox-point-field-widget.html:18
msgid "Done"
msgstr "完成"

#: templates/mapwidgets/google-point-field-widget.html:22
#: templates/mapwidgets/mapbox-point-field-widget.html:22
msgid "Use My Location"
msgstr "使用当前位置"

#: templates/mapwidgets/google-point-field-widget.html:23
#: templates/mapwidgets/mapbox-point-field-widget.html:23
msgid "Choose point on map"
msgstr "在地图上标注"

#: templates/mapwidgets/google-point-field-widget.html:25
#: templates/mapwidgets/mapbox-point-field-widget.html:64
msgid "Find a Location by Address"
msgstr "输入地址查找"
1 change: 1 addition & 0 deletions mapwidgets/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
("mapCenterLocationName", None),
("mapCenterLocation", TIMEZONE_COORDINATES.get(getattr(django_settings, "TIME_ZONE", "UTC"))),
("zoom", 12),
("scrollWheel", False),
("GooglePlaceAutocompleteOptions", {}),
("markerFitZoom", 14),
("streetViewControl", True),
Expand Down
4 changes: 2 additions & 2 deletions mapwidgets/static/mapwidgets/js/mw_google_point_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
this.map = new google.maps.Map(this.mapElement, {
center: new google.maps.LatLng(mapCenter[0], mapCenter[1]),
scrollwheel: false,
scrollwheel: this.scrollWheel,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT
},
Expand All @@ -31,7 +31,7 @@
}else{
this.map = new google.maps.Map(this.mapElement, {
center: new google.maps.LatLng(mapCenter[0], mapCenter[1]),
scrollwheel: false,
scrollwheel: this.scrollWheel,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
addMarkerBtn: $(".mw-btn-add-marker", wrapElemSelector),
loaderOverlayElem: $(".mw-loader-overlay", wrapElemSelector),
zoom: mapOptions.zoom,
scrollWheel: mapOptions.scrollWheel,
markerFitZoom: mapOptions.markerFitZoom,
GooglePlaceAutocompleteOptions: mapOptions.GooglePlaceAutocompleteOptions,
markerCreateTriggerNameSpace: "google_point_map_widget:marker_create",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
deleteBtn: $(".mw-btn-delete", wrapElemSelector),
addMarkerBtn: $(".mw-btn-add-marker", wrapElemSelector),
loaderOverlayElem: $(".mw-loader-overlay", wrapElemSelector),
scrollWheel: mapOptions.scrollWheel,
zoom: mapOptions.zoom,
markerFitZoom: mapOptions.markerFitZoom,
GooglePlaceAutocompleteOptions: mapOptions.GooglePlaceAutocompleteOptions,
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[metadata]
license-file = LICENSE
description-file = README.md
license_file = LICENSE
description_file = README.md
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

VERSION = (0, 4, 0)
VERSION = (0, 4, 1)
__version__ = '.'.join(map(str, VERSION))


Expand Down

0 comments on commit ce64660

Please sign in to comment.