Skip to content

Commit 9c777bf

Browse files
author
vulture
committed
layout css simplified, previous had problems on Samsung tab default browser.
- transiotions removed, had artifacts when do not use display:none;
1 parent 2296bff commit 9c777bf

File tree

3 files changed

+57
-98
lines changed

3 files changed

+57
-98
lines changed

Control.Geocoder.css

Lines changed: 43 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,56 @@
11
.leaflet-control-geocoder {
22
background: white;
3-
box-shadow: 0 1px 7px rgba(0,0,0,0.65);
4-
-webkit-border-radius: 4px;
5-
border-radius: 4px;
6-
line-height: 26px;
7-
overflow: hidden;
83
}
9-
10-
.leaflet-touch .leaflet-control-geocoder {
11-
box-shadow: none;
12-
border: 2px solid rgba(0,0,0,0.2);
13-
background-clip: padding-box;
14-
line-height: 30px;
4+
.leaflet-control-geocoder a {
5+
border-bottom-left-radius: 4px;
6+
border-bottom-right-radius: 4px;
7+
border-bottom: none;
8+
display: inline-block;
9+
}
10+
.leaflet-control-geocoder a:hover {
11+
border-bottom: none;
12+
display: inline-block;
1513
}
1614

1715
.leaflet-control-geocoder-form {
18-
display: inline;
16+
display: none;
17+
vertical-align: middle;
1918
}
20-
21-
.leaflet-control-geocoder-form input, .leaflet-control-geocoder-form ul, .leaflet-control-geocoder-error {
22-
border: 0;
23-
color: transparent;
24-
background: white;
19+
.leaflet-control-geocoder-expanded .leaflet-control-geocoder-form {
20+
display: inline-block;
2521
}
26-
2722
.leaflet-control-geocoder-form input {
28-
font-size: 16px;
29-
width: 0;
30-
transition: width 0.125s ease-in;
31-
}
32-
33-
.leaflet-control-geocoder-form input{
34-
padding: 0px;
35-
}
36-
37-
.leaflet-touch .leaflet-control-geocoder-form input {
38-
font-size: 22px;
23+
font-size: 120%;
24+
border: 0;
25+
background-color: transparent;
26+
width: 246px;
3927
}
40-
41-
.leaflet-control-geocoder-icon {
28+
/*.leaflet-control-geocoder-icon {
4229
width: 26px;
4330
height: 26px;
4431
background-image: url(images/geocoder.png);
4532
background-repeat: no-repeat;
4633
background-position: center;
4734
float: right;
4835
cursor: pointer;
49-
}
36+
}*/
5037

51-
.leaflet-touch .leaflet-control-geocoder-icon {
38+
/*.leaflet-touch .leaflet-control-geocoder-icon {
5239
margin-top: 2px;
5340
width: 30px;
54-
}
41+
}*/
5542

43+
.leaflet-control-geocoder-icon {
44+
background-image: url(images/geocoder.png);
45+
background-repeat: no-repeat;
46+
background-position: center;
47+
}
5648
.leaflet-control-geocoder-throbber .leaflet-control-geocoder-icon {
5749
background-image: url(images/throbber.gif);
5850
}
5951

60-
.leaflet-control-geocoder-expanded input, .leaflet-control-geocoder-error {
61-
width: 226px;
62-
margin: 0 0 0 4px;
63-
padding: 0 0 0 4px;
64-
vertical-align: middle;
65-
color: #000;
52+
.leaflet-control-geocoder-form-no-error {
53+
display: none;
6654
}
6755

6856
.leaflet-control-geocoder-form input:focus {
@@ -73,72 +61,43 @@
7361
display: none;
7462
}
7563

76-
.leaflet-control-geocoder-form-no-error {
77-
display: none;
78-
}
7964

8065
.leaflet-control-geocoder-error {
8166
margin-top: 8px;
8267
display: block;
8368
color: #444;
8469
}
8570

86-
ul.leaflet-control-geocoder-alternatives {
87-
width: 260px;
88-
overflow: hidden;
89-
text-overflow: ellipsis;
90-
white-space: nowrap;
91-
list-style: none;
92-
padding: 0;
93-
transition: height 0.125s ease-in;
71+
.leaflet-control-geocoder-alternatives {
72+
display: block;
73+
width: 272px;
74+
list-style: none;
75+
padding: 0;
76+
margin: 0;
9477
}
9578

9679
.leaflet-control-geocoder-alternatives-minimized {
97-
width: 0 !important;
80+
display: none;
9881
height: 0;
99-
overflow: hidden;
100-
margin: 0;
101-
padding: 0;
10282
}
103-
10483
.leaflet-control-geocoder-alternatives li {
105-
width: 100%;
84+
white-space: nowrap;
85+
display: block;
10686
overflow: hidden;
87+
padding: 5px 8px;
10788
text-overflow: ellipsis;
108-
border-bottom: 1px solid #eee;
109-
padding: 0;
89+
border-bottom: 1px solid #ccc;
90+
cursor: pointer;
11091
}
111-
112-
11392
.leaflet-control-geocoder-alternatives li:last-child {
11493
border-bottom: none;
11594
}
116-
117-
.leaflet-control-geocoder-alternatives a {
118-
display: block;
119-
text-decoration: none;
120-
color: black;
121-
padding: 6px 8px 16px 6px;
122-
font-size: 14px;
123-
line-height: 1;
124-
font-weight: bold;
95+
.leaflet-control-geocoder-alternatives li:hover, .leaflet-control-geocoder-selected {
96+
background-color: #f5f5f5;
12597
}
126-
127-
.leaflet-touch .leaflet-control-geocoder-alternatives a {
128-
font-size: 18px;
129-
}
130-
131-
.leaflet-control-geocoder-alternatives a:hover, .leaflet-control-geocoder-selected {
132-
background-color: #ddd;
133-
}
134-
13598
.leaflet-control-geocoder-address-detail {
136-
font-size: 12px;
137-
font-weight: normal;
99+
138100
}
139-
140101
.leaflet-control-geocoder-address-context {
141102
color: #666;
142-
font-size: 12px;
143-
font-weight: lighter;
144103
}

Control.Geocoder.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@
3737

3838
onAdd: function (map) {
3939
var className = 'leaflet-control-geocoder',
40-
container = L.DomUtil.create('div', className),
41-
icon = L.DomUtil.create('div', 'leaflet-control-geocoder-icon', container),
42-
form = this._form = L.DomUtil.create('form', className + '-form', container),
43-
input;
40+
container = L.DomUtil.create('div', className + ' leaflet-bar'),
41+
icon = L.DomUtil.create('a', 'leaflet-control-geocoder-icon', container),
42+
form = this._form = L.DomUtil.create('form', className + '-form', container),
43+
input;
4444

45+
icon.innerHTML = ' ';
46+
icon.href = '#';
4547
this._map = map;
4648
this._container = container;
4749
input = this._input = L.DomUtil.create('input');
@@ -163,21 +165,19 @@
163165

164166
_createAlt: function(result, index) {
165167
var li = document.createElement('li'),
166-
a = L.DomUtil.create('a', '', li),
167-
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null,
168-
text = result.html ? undefined : document.createTextNode(result.name);
168+
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', li) : null,
169+
text = result.html ? undefined : document.createTextNode(result.name);
169170

170171
if (icon) {
171172
icon.src = result.icon;
172173
}
173174

174-
a.href = '#';
175-
a.setAttribute('data-result-index', index);
175+
li.setAttribute('data-result-index', index);
176176

177177
if (result.html) {
178-
a.innerHTML = result.html;
178+
li.innerHTML = result.html;
179179
} else {
180-
a.appendChild(text);
180+
li.appendChild(text);
181181
}
182182

183183
L.DomEvent.addListener(li, 'click', function clickHandler(e) {
@@ -192,15 +192,15 @@
192192
var _this = this,
193193
select = function select(dir) {
194194
if (_this._selection) {
195-
L.DomUtil.removeClass(_this._selection.firstChild, 'leaflet-control-geocoder-selected');
195+
L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected');
196196
_this._selection = _this._selection[dir > 0 ? 'nextSibling' : 'previousSibling'];
197197
}
198198
if (!_this._selection) {
199199
_this._selection = _this._alts[dir > 0 ? 'firstChild' : 'lastChild'];
200200
}
201201

202202
if (_this._selection) {
203-
L.DomUtil.addClass(_this._selection.firstChild, 'leaflet-control-geocoder-selected');
203+
L.DomUtil.addClass(_this._selection, 'leaflet-control-geocoder-selected');
204204
}
205205
};
206206

@@ -224,7 +224,7 @@
224224
// Enter
225225
case 13:
226226
if (this._selection) {
227-
var index = parseInt(this._selection.firstChild.getAttribute('data-result-index'), 10);
227+
var index = parseInt(this._selection.getAttribute('data-result-index'), 10);
228228
this._geocodeResultSelected(this._results[index]);
229229
this._clearResults();
230230
L.DomEvent.preventDefault(e);

images/geocoder.png

24 Bytes
Loading

0 commit comments

Comments
 (0)