From ce646604e70d84a5ff4022ac54bfd5543df14326 Mon Sep 17 00:00:00 2001 From: Erdem Ozkol <github@erdemozkol.com> Date: Wed, 21 Dec 2022 16:09:43 +0000 Subject: [PATCH] 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 --- README.md | 4 + README.rst | 19 ++--- demo/demo/settings.py | 8 +- .../google_point_field_map_widgets.rst | 3 + mapwidgets/locale/zh/LC_MESSAGES/django.mo | Bin 0 -> 778 bytes mapwidgets/locale/zh/LC_MESSAGES/django.po | 75 ++++++++++++++++++ mapwidgets/settings.py | 1 + .../mapwidgets/js/mw_google_point_field.js | 4 +- .../google-point-field-inline-widget.html | 1 + .../mapwidgets/google-point-field-widget.html | 1 + setup.cfg | 4 +- setup.py | 2 +- 12 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 mapwidgets/locale/zh/LC_MESSAGES/django.mo create mode 100644 mapwidgets/locale/zh/LC_MESSAGES/django.po diff --git a/README.md b/README.md index a538995..07230a9 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/README.rst b/README.rst index 2f38970..c1a1f2f 100644 --- a/README.rst +++ b/README.rst @@ -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 ================== @@ -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 ===== diff --git a/demo/demo/settings.py b/demo/demo/settings.py index 7bcd925..bb96ad6 100644 --- a/demo/demo/settings.py +++ b/demo/demo/settings.py @@ -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 @@ -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, @@ -159,4 +160,3 @@ }, "GOOGLE_MAP_API_KEY": GOOGLE_MAP_API_KEY } - diff --git a/docs/widgets/google_point_field_map_widgets.rst b/docs/widgets/google_point_field_map_widgets.rst index c47fe3e..4db4b2a 100644 --- a/docs/widgets/google_point_field_map_widgets.rst +++ b/docs/widgets/google_point_field_map_widgets.rst @@ -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. @@ -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>" diff --git a/mapwidgets/locale/zh/LC_MESSAGES/django.mo b/mapwidgets/locale/zh/LC_MESSAGES/django.mo new file mode 100644 index 0000000000000000000000000000000000000000..4cfcc91fc2b6634275d81c31ef316d161e050c6a GIT binary patch literal 778 zcmYL`&ubGw6vszx{jn%YJqYSyt|Ai~Ye~9R>6&b6a5o8?q+s!~&5qlZbSCUhw7H2O zTCudydeIg|Xo(;}5JYQ}-ux3hddenxvYx#9rbhGN%V*x(@4ok#`8G803_&QMv!F8Q z7-$<LV;6K1^b0fq8r+A_37`U$zB4_Z1D=LF20Q|^fU@T;;BlY}JO#Q38iIUjKSBqA zuYpH_Z-CPGp~o*k>H7+lz8^jA_UgZZ&}#3SoOb~9F9zWtXUmW~9|nOP9Ri`mEaw5m z749*CIm2^y1tmG7NOwGeOPu?T$813Zq|dAPVmvYy8yg)N-pejUBg4_r=tvBuJmz2< z8@yx-54z0Mu;w^E4FY69MN}QCB7-xxcPzq4v-aPQaz4L9OM;{wGDZCWTBtauC2nYw zI-b(4d^(#^EL!2dAZFlt4!Kr!15)5BR&rTl(Yv1fha_Q972nh~i<nuG)bRDJYNpRm zXEVBD*nuDg-)2GC7Ti~Hs%RKEqnSD$*G(;LOlZlZrRVck!OGmK?NU;p_MD0hEi+k^ zn~WRAMA?gQ-|c%~12b*v{k7pvlmusjG8k8@z&?V`iwl*q?Xk<aG;8|-6<3Od6p8nJ za;@9cCps%}xNld*@flAjC|s+DYwyArt@g(!omY=K@9QXRJncMQM(v$OXZ2IKz6@m) zZa(<A{k;D;fAjwHd~dCU4>x3|_4}Qd8=Zv~>TbOaw>DAt^O8inxzk;(hs~96VX@s@ I>^2+d4|&<#82|tP literal 0 HcmV?d00001 diff --git a/mapwidgets/locale/zh/LC_MESSAGES/django.po b/mapwidgets/locale/zh/LC_MESSAGES/django.po new file mode 100644 index 0000000..4f0d304 --- /dev/null +++ b/mapwidgets/locale/zh/LC_MESSAGES/django.po @@ -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 <LL@li.org>\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 "输入地址查找" \ No newline at end of file diff --git a/mapwidgets/settings.py b/mapwidgets/settings.py index 8ab6dd0..40f3952 100644 --- a/mapwidgets/settings.py +++ b/mapwidgets/settings.py @@ -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), diff --git a/mapwidgets/static/mapwidgets/js/mw_google_point_field.js b/mapwidgets/static/mapwidgets/js/mw_google_point_field.js index 5be3257..1740bf0 100644 --- a/mapwidgets/static/mapwidgets/js/mw_google_point_field.js +++ b/mapwidgets/static/mapwidgets/js/mw_google_point_field.js @@ -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 }, @@ -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 }, diff --git a/mapwidgets/templates/mapwidgets/google-point-field-inline-widget.html b/mapwidgets/templates/mapwidgets/google-point-field-inline-widget.html index 9521034..36da544 100644 --- a/mapwidgets/templates/mapwidgets/google-point-field-inline-widget.html +++ b/mapwidgets/templates/mapwidgets/google-point-field-inline-widget.html @@ -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", diff --git a/mapwidgets/templates/mapwidgets/google-point-field-widget.html b/mapwidgets/templates/mapwidgets/google-point-field-widget.html index b2c87cf..42230c2 100644 --- a/mapwidgets/templates/mapwidgets/google-point-field-widget.html +++ b/mapwidgets/templates/mapwidgets/google-point-field-widget.html @@ -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, diff --git a/setup.cfg b/setup.cfg index be99247..eb5d3b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,3 @@ [metadata] -license-file = LICENSE -description-file = README.md +license_file = LICENSE +description_file = README.md diff --git a/setup.py b/setup.py index 4ced616..49e7d20 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = (0, 4, 0) +VERSION = (0, 4, 1) __version__ = '.'.join(map(str, VERSION))