Skip to content

Commit 020c564

Browse files
committed
Dedup code
1 parent 2b6fe97 commit 020c564

File tree

4 files changed

+90
-124
lines changed

4 files changed

+90
-124
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.2.2
2+
* Deduplicated ``tLMapZoomPanOptions``
3+
14
## 4.2.1
25
* Handle ``LEvented#off`` in the same way as ``LEvented#on``
36
* Fix incorrect formatting leading to JS error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright © 2019 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.vaadin.maps.leaflet.map;
17+
18+
/**
19+
* @see <a href="https://leafletjs.com/reference.html#zoom/pan-options">Leaflet docs</a>
20+
*/
21+
public class AbstractLMapZoomPanOptions<T extends AbstractLMapZoomPanOptions<T>>
22+
implements
23+
LMapZoomBaseOptions<T>,
24+
LMapPanBaseOptions<T>
25+
{
26+
private Boolean animate;
27+
private Double duration;
28+
private Double easeLinearity;
29+
private Boolean noMoveStart;
30+
31+
@Override
32+
public Boolean getAnimate()
33+
{
34+
return this.animate;
35+
}
36+
37+
@Override
38+
public void setAnimate(final Boolean animate)
39+
{
40+
this.animate = animate;
41+
}
42+
43+
@Override
44+
public T withAnimate(final Boolean animate)
45+
{
46+
return LMapZoomBaseOptions.super.withAnimate(animate);
47+
}
48+
49+
@Override
50+
public Double getDuration()
51+
{
52+
return this.duration;
53+
}
54+
55+
@Override
56+
public void setDuration(final Double duration)
57+
{
58+
this.duration = duration;
59+
}
60+
61+
@Override
62+
public Double getEaseLinearity()
63+
{
64+
return this.easeLinearity;
65+
}
66+
67+
@Override
68+
public void setEaseLinearity(final Double easeLinearity)
69+
{
70+
this.easeLinearity = easeLinearity;
71+
}
72+
73+
@Override
74+
public Boolean getNoMoveStart()
75+
{
76+
return this.noMoveStart;
77+
}
78+
79+
@Override
80+
public void setNoMoveStart(final Boolean noMoveStart)
81+
{
82+
this.noMoveStart = noMoveStart;
83+
}
84+
}

vaadin-maps-leaflet-flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapFitBoundOptions.java

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -21,77 +21,15 @@
2121
/**
2222
* @see <a href="https://leafletjs.com/reference.html#fitbounds-options-option">Leaflet docs</a>
2323
*/
24-
public class LMapFitBoundOptions
25-
implements
26-
LMapZoomBaseOptions<LMapFitBoundOptions>,
27-
LMapPanBaseOptions<LMapFitBoundOptions>,
28-
LMapPaddingBaseOptions<LMapFitBoundOptions>
24+
public class LMapFitBoundOptions extends AbstractLMapZoomPanOptions<LMapFitBoundOptions>
25+
implements LMapPaddingBaseOptions<LMapFitBoundOptions>
2926
{
30-
private Boolean animate;
31-
private Double duration;
32-
private Double easeLinearity;
33-
private Boolean noMoveStart;
34-
3527
private LPoint paddingTopLeft;
3628
private LPoint paddingBottomRight;
3729
private LPoint padding;
3830

3931
private Integer maxZoom;
4032

41-
@Override
42-
public Boolean getAnimate()
43-
{
44-
return this.animate;
45-
}
46-
47-
@Override
48-
public void setAnimate(final Boolean animate)
49-
{
50-
this.animate = animate;
51-
}
52-
53-
@Override
54-
public LMapFitBoundOptions withAnimate(final Boolean animate)
55-
{
56-
return LMapZoomBaseOptions.super.withAnimate(animate);
57-
}
58-
59-
@Override
60-
public Double getDuration()
61-
{
62-
return this.duration;
63-
}
64-
65-
@Override
66-
public void setDuration(final Double duration)
67-
{
68-
this.duration = duration;
69-
}
70-
71-
@Override
72-
public Double getEaseLinearity()
73-
{
74-
return this.easeLinearity;
75-
}
76-
77-
@Override
78-
public void setEaseLinearity(final Double easeLinearity)
79-
{
80-
this.easeLinearity = easeLinearity;
81-
}
82-
83-
@Override
84-
public Boolean getNoMoveStart()
85-
{
86-
return this.noMoveStart;
87-
}
88-
89-
@Override
90-
public void setNoMoveStart(final Boolean noMoveStart)
91-
{
92-
this.noMoveStart = noMoveStart;
93-
}
94-
9533
@Override
9634
public LPoint getPaddingTopLeft()
9735
{

vaadin-maps-leaflet-flow/src/main/java/software/xdev/vaadin/maps/leaflet/map/LMapZoomPanOptions.java

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,6 @@
1818
/**
1919
* @see <a href="https://leafletjs.com/reference.html#zoom/pan-options">Leaflet docs</a>
2020
*/
21-
public class LMapZoomPanOptions
22-
implements LMapZoomBaseOptions<LMapZoomPanOptions>, LMapPanBaseOptions<LMapZoomPanOptions>
21+
public class LMapZoomPanOptions extends AbstractLMapZoomPanOptions<LMapZoomPanOptions>
2322
{
24-
private Boolean animate;
25-
private Double duration;
26-
private Double easeLinearity;
27-
private Boolean noMoveStart;
28-
29-
@Override
30-
public Boolean getAnimate()
31-
{
32-
return this.animate;
33-
}
34-
35-
@Override
36-
public void setAnimate(final Boolean animate)
37-
{
38-
this.animate = animate;
39-
}
40-
41-
@Override
42-
public LMapZoomPanOptions withAnimate(final Boolean animate)
43-
{
44-
return LMapZoomBaseOptions.super.withAnimate(animate);
45-
}
46-
47-
@Override
48-
public Double getDuration()
49-
{
50-
return this.duration;
51-
}
52-
53-
@Override
54-
public void setDuration(final Double duration)
55-
{
56-
this.duration = duration;
57-
}
58-
59-
@Override
60-
public Double getEaseLinearity()
61-
{
62-
return this.easeLinearity;
63-
}
64-
65-
@Override
66-
public void setEaseLinearity(final Double easeLinearity)
67-
{
68-
this.easeLinearity = easeLinearity;
69-
}
70-
71-
@Override
72-
public Boolean getNoMoveStart()
73-
{
74-
return this.noMoveStart;
75-
}
76-
77-
@Override
78-
public void setNoMoveStart(final Boolean noMoveStart)
79-
{
80-
this.noMoveStart = noMoveStart;
81-
}
8223
}

0 commit comments

Comments
 (0)