Skip to content

Commit 0e5d0de

Browse files
committed
moved shared property to JLObject
Signed-off-by: makbn <mehdi74akbarian@gmail.com>
1 parent be674b7 commit 0e5d0de

File tree

2 files changed

+47
-45
lines changed

2 files changed

+47
-45
lines changed

jlmap-api/src/main/java/io/github/makbn/jlmap/model/JLMarker.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,6 @@ public final class JLMarker extends JLObject<JLMarker> {
3434
*/
3535
@NonFinal
3636
JLLatLng latLng;
37-
/**
38-
* By default, marker images zIndex is set automatically based on its latitude.
39-
* Use this option if you want to put the marker on top of all others (or below),
40-
* specifying a high value like 1000 (or high negative value, respectively).
41-
*/
42-
@NonFinal
43-
int zIndexOffset = 0;
44-
/**
45-
* The opacity of the marker.
46-
*/
47-
@NonFinal
48-
double opacity = 1.0;
4937

5038
@NonFinal
5139
JLIcon icon;
@@ -87,36 +75,6 @@ public JLMarker setLatLng(JLLatLng latLng) {
8775
return this;
8876
}
8977

90-
/**
91-
* By default, marker images zIndex is set automatically based on its latitude. Use this option if you want
92-
* to put the marker on top of all others (or below), specifying a high value like 1000 (or high
93-
* negative value, respectively).
94-
* Read more <a href="https://leafletjs.com/reference.html#marker-zindexoffset">here</a>!
95-
*
96-
* @param offset new zIndex offset of the marker.
97-
* @return the current instance of JLMarker.
98-
*/
99-
public JLMarker setZIndexOffset(int offset) {
100-
getTransport().execute(new JLTransport(this,
101-
String.format("this.%s.setZIndexOffset(%d);", getId(), offset)));
102-
this.zIndexOffset = offset;
103-
return this;
104-
}
105-
106-
/**
107-
* Changes the marker opacity.
108-
* Read more <a href="https://leafletjs.com/reference.html#marker-opacity">here</a>!
109-
*
110-
* @param opacity value between 0.0 and 1.0.
111-
* @return the current instance of JLMarker.
112-
*/
113-
public JLMarker setOpacity(double opacity) {
114-
getTransport().execute(new JLTransport(this,
115-
String.format("this.%s.setOpacity(%f);", getId(), opacity)));
116-
this.opacity = opacity;
117-
return this;
118-
}
119-
12078
/**
12179
* Changes the marker icon.
12280
*

jlmap-api/src/main/java/io/github/makbn/jlmap/model/JLObject.java

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.makbn.jlmap.model;
22

3+
import io.github.makbn.jlmap.engine.JLTransport;
34
import io.github.makbn.jlmap.engine.JLTransporter;
45
import io.github.makbn.jlmap.listener.OnJLObjectActionListener;
56
import io.github.makbn.jlmap.model.function.JLFunctionBase;
@@ -17,10 +18,9 @@
1718
*/
1819
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
1920
@FieldDefaults(level = AccessLevel.PROTECTED, makeFinal = true)
20-
public abstract sealed class JLObject<T extends JLObject<T>> implements JLFunctionBase<T> permits
21-
JLCircle, JLCircleMarker, JLGeoJson, JLMarker, JLMultiPolyline, JLPolygon, JLPolyline, JLPopup {
21+
public abstract sealed class JLObject<T extends JLObject<T>> implements JLFunctionBase<T> permits JLCircle, JLCircleMarker, JLGeoJson, JLImageOverlay, JLMarker, JLMultiPolyline, JLPolygon, JLPolyline, JLPopup {
2222

23-
@Getter(AccessLevel.PROTECTED)
23+
@Getter(AccessLevel.PUBLIC)
2424
JLTransporter<?> transport;
2525

2626
@NonFinal
@@ -30,6 +30,19 @@ public abstract sealed class JLObject<T extends JLObject<T>> implements JLFuncti
3030
@NonFinal
3131
JLPopup popup;
3232

33+
/**
34+
* By default, marker images zIndex is set automatically based on its latitude.
35+
* Use this option if you want to put the marker on top of all others (or below),
36+
* specifying a high value like 1000 (or high negative value, respectively).
37+
*/
38+
@NonFinal
39+
int zIndexOffset = 0;
40+
/**
41+
* The opacity of the marker.
42+
*/
43+
@NonFinal
44+
double opacity = 1.0;
45+
3346
public OnJLObjectActionListener<T> getOnActionListener() {
3447
return listener;
3548
}
@@ -43,4 +56,35 @@ public void setOnActionListener(OnJLObjectActionListener<T> listener) {
4356
public void update(Object... params) {
4457

4558
}
59+
60+
61+
/**
62+
* By default, marker images zIndex is set automatically based on its latitude. Use this option if you want
63+
* to put the marker on top of all others (or below), specifying a high value like 1000 (or high
64+
* negative value, respectively).
65+
* Read more <a href="https://leafletjs.com/reference.html#marker-zindexoffset">here</a>!
66+
*
67+
* @param offset new zIndex offset of the marker.
68+
* @return the current instance of JLMarker.
69+
*/
70+
public T setZIndexOffset(int offset) {
71+
getTransport().execute(new JLTransport(this,
72+
String.format("this.%s.setZIndexOffset(%d);", getId(), offset)));
73+
this.zIndexOffset = offset;
74+
return self();
75+
}
76+
77+
/**
78+
* Changes the marker opacity.
79+
* Read more <a href="https://leafletjs.com/reference.html#marker-opacity">here</a>!
80+
*
81+
* @param opacity value between 0.0 and 1.0.
82+
* @return the current instance of JLMarker.
83+
*/
84+
public T setOpacity(double opacity) {
85+
getTransport().execute(new JLTransport(this,
86+
String.format("this.%s.setOpacity(%f);", getId(), opacity)));
87+
this.opacity = opacity;
88+
return self();
89+
}
4690
}

0 commit comments

Comments
 (0)