Skip to content

Commit

Permalink
[BUILD]
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Jun 21, 2024
1 parent d83662d commit d1a9f23
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
21 changes: 21 additions & 0 deletions dist/ol-ext.css
Original file line number Diff line number Diff line change
Expand Up @@ -4116,10 +4116,14 @@ ul.ol-legend li div {
text-align: left;
}
.ol-searchgps.ol-control.ol-collapsed button.ol-geoloc,
.ol-searchgps.ol-control.ol-collapsed button.ol-centerloc,
.ol-searchcoord.ol-control.ol-collapsed button.ol-centerloc,
.ol-searchcoord.ol-control.ol-collapsed button.ol-geoloc {
display: none;
}
.ol-searchgps button.ol-geoloc,
.ol-searchgps button.ol-centerloc,
.ol-searchcoord button.ol-centerloc,
.ol-searchcoord button.ol-geoloc {
top: 0;
float: right;
Expand Down Expand Up @@ -4158,6 +4162,23 @@ ul.ol-legend li div {
.45em 0 currentColor, -.45em 0 currentColor, 0 -.45em currentColor, 0 .45em currentColor,
.25em 0 currentColor, -.25em 0 currentColor, 0 -.25em currentColor, 0 .25em currentColor;
}

.ol-searchgps button.ol-centerloc:before,
.ol-searchcoord button.ol-centerloc:before {
content: "📍";
border: 0;
width: auto;
height: auto;
padding: 0;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.ol-searchgps button.ol-centerloc:after,
.ol-searchcoord button.ol-centerloc:after {
display: none;
}
.ol-control.ol-select {
top: .5em;
left: 3em;
Expand Down
48 changes: 47 additions & 1 deletion dist/ol-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -15577,7 +15577,8 @@ ol.control.SearchBAN = class olcontrolSearchBAN extends ol.control.SearchPhoton
* @param {string} [options.className] control class name
* @param {Element | string } [options.target] Specify a target if you want the control to be rendered outside of the map's viewport.
* @param {string} [options.label="search"] Text label to use for the search button, default "search"
* @param {string} [options.labelGPS="Locate with GPS"] placeholder, default "Locate with GPS"
* @param {string} [options.labelGPS="Locate with GPS"] placeholder
* @param {string} [options.labelCenter="Map center"] placeholder
* @param {number} [options.typing=300] a delay on each typing to start searching (ms), default 300.
* @param {integer} [options.minLength=1] minimum length to start searching, default 1
* @param {integer} [options.maxItems=10] maximum number of items to display in the autocomplete list, default 10
Expand Down Expand Up @@ -15609,11 +15610,40 @@ ol.control.SearchCoordinates = class olcontrolSearchCoordinates extends ol.contr
this.geolocation.setTracking(true);
}.bind(this)
});
ol.ext.element.create('BUTTON', {
className: 'ol-centerloc',
title: options.labelCenter || 'Map center',
parent: this.element,
click: function () {
this.setInput()
}.bind(this)
});
this._createForm();
// Move list to the end
var ul = this.element.querySelector("ul.autocomplete");
this.element.appendChild(ul);
}
/** Set the input value in the form (for initialisation purpose)
* @param {Array<number>} [coord] if none get the map center
* @api
*/
setInput(coord) {
if (!coord) {
if (!this.getMap()) return
coord = this.getMap().getView().getCenter();
coord = ol.proj.transform(coord, this.getMap().getView().getProjection(), this.getProjection())
}
var d = Math.pow(10, this.get('digit'))
this.inputs_[0].value = Math.round(coord[0] * d) / d
this.inputs_[1].value = Math.round(coord[1] * d) / d;
this._triggerCustomEvent('keyup', this.inputs_[0]);
}
/** Get the control projection
* @returns {ol/proj/ProjectionLike}
*/
getProjection() {
return this.projection_
}
/** Set the projection
* @param {ol/proj/ProjectionLike} proj
*/
Expand Down Expand Up @@ -15679,6 +15709,7 @@ ol.control.SearchCoordinates = class olcontrolSearchCoordinates extends ol.contr
lonx.focus();
});
}
this.inputs_ = [ lonx, laty ];
// Change value on click
this.on('select', function (e) {
lonx.value = e.search.gps[0];
Expand Down Expand Up @@ -15958,6 +15989,20 @@ ol.control.SearchGPS = class olcontrolSearchGPS extends ol.control.Search {
var ul = this.element.querySelector("ul.autocomplete");
this.element.appendChild(ul);
}
/** Set the input value in the form (for initialisation purpose)
* @param {Array<number>} [coord] if none get the map center
* @api
*/
setInput(coord) {
if (!coord) {
if (!this.getMap()) return
coord = this.getMap().getView().getCenter();
coord = ol.proj.transform(coord, this.getMap().getView().getProjection(), 'EPSG:4326')
}
this.inputs_[0].value = coord[0];
this.inputs_[1].value = coord[1];
this._triggerCustomEvent('keyup', this.inputs_[0]);
}
/** Create input form
* @private
*/
Expand Down Expand Up @@ -16035,6 +16080,7 @@ ol.control.SearchGPS = class olcontrolSearchGPS extends ol.control.Search {
var latd = createInput('ol-dms', '°');
var latm = createInput('ol-dms', '\'');
var lats = createInput('ol-dms', '"');
this.inputs_ = [lon, lat]
// Focus on open
if (this.button) {
this.button.addEventListener("click", function () {
Expand Down
2 changes: 1 addition & 1 deletion dist/ol-ext.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ol-ext.min.js

Large diffs are not rendered by default.

0 comments on commit d1a9f23

Please sign in to comment.