File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -101,22 +101,18 @@ class EventHandler(MacroElement):
101101 >>>
102102 >>> g = folium.GeoJson(geo_json_data).add_to(m)
103103 >>>
104- >>> highlight = JsCode(
105- ... """
104+ >>> highlight = JsCode("""
106105 ... function highlight(e) {
107106 ... e.target.original_color = e.layer.options.color;
108107 ... e.target.setStyle({ color: "green" });
109108 ... }
110- ... """
111- ... )
109+ ... """)
112110 >>>
113- >>> reset = JsCode(
114- ... """
111+ >>> reset = JsCode("""
115112 ... function reset(e) {
116113 ... e.target.setStyle({ color: e.target.original_color });
117114 ... }
118- ... """
119- ... )
115+ ... """)
120116 >>>
121117 >>> g.add_child(EventHandler("mouseover", highlight))
122118 >>> g.add_child(EventHandler("mouseout", reset))
Original file line number Diff line number Diff line change @@ -42,15 +42,11 @@ class Draw(JSCSSMixin, MacroElement):
4242 ... position="topleft",
4343 ... draw_options={"polyline": {"allowIntersection": False}},
4444 ... edit_options={"poly": {"allowIntersection": False}},
45- ... on={
46- ... "click": JsCode(
47- ... """
45+ ... on={"click": JsCode("""
4846 ... function(event) {
4947 ... alert(JSON.stringify(this.toGeoJSON()));
5048 ... }
51- ... """
52- ... )
53- ... },
49+ ... """)},
5450 ... ).add_to(m)
5551
5652 For more info please check
Original file line number Diff line number Diff line change @@ -53,8 +53,7 @@ class Timeline(GeoJson):
5353
5454 >>> timeline = Timeline(
5555 ... data,
56- ... get_interval=JsCode(
57- ... '''
56+ ... get_interval=JsCode('''
5857 ... function (quake) {
5958 ... // earthquake data only has a time, so we\' ll use that as a "start"
6059 ... // and the "end" will be that + some value based on magnitude
@@ -65,8 +64,7 @@ class Timeline(GeoJson):
6564 ... end: quake.properties.time + quake.properties.mag * 1800000,
6665 ... };
6766 ... };
68- ... '''
69- ... ),
67+ ... '''),
7068 ... ).add_to(m)
7169 >>> TimelineSlider(
7270 ... auto_play=False,
You can’t perform that action at this time.
0 commit comments