Skip to content

Commit 32af15e

Browse files
Revert the change of making color_scale a private attribute that is observed in Velocity.js.
1 parent ed48e77 commit 32af15e

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

examples/Velocity_with_colormap.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"# Set up for JupyterLite\n",
2121
"try:\n",
2222
" import piplite\n",
23-
" await piplite.install(['ipyleaflet')\n",
23+
" await piplite.install('ipyleaflet')\n",
2424
"except ImportError:\n",
2525
" pass"
2626
]

ipyleaflet/velocity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ class Velocity(Layer):
7171
max_velocity = Float(10).tag(sync=True, o=True)
7272
velocity_scale = Float(0.005).tag(sync=True, o=True)
7373
colormap = Any(linear.OrRd_06)
74-
_color_scale = List([]).tag(sync=True, o=True)
74+
color_scale = List([]).tag(sync=True, o=True)
7575

76-
@default('_color_scale')
76+
@default('color_scale')
7777
def _default_color_scale(self):
78-
self._color_scale = []
78+
self.color_scale = []
7979

8080
for color in self.colormap.colors:
8181
rgb_tuple = tuple(int(x * 256) for x in color[:3])
8282
rgb_str = f"rgb{rgb_tuple}"
83-
self._color_scale.append(rgb_str)
83+
self.color_scale.append(rgb_str)
8484

85-
return self._color_scale
85+
return self.color_scale

js/src/layers/Velocity.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class LeafletVelocityModel extends layer.LeafletLayerModel {
2525
minVelocity: 0,
2626
maxVelocity: 10,
2727
velocityScale: 0.005,
28-
_colorScale: []
28+
colorScale: []
2929
};
3030
}
3131
}
@@ -60,13 +60,5 @@ export class LeafletVelocityView extends layer.LeafletLayerView {
6060
},
6161
this
6262
);
63-
this.listenTo(
64-
this.model,
65-
'change:_colorScale',
66-
function () {
67-
this.layer_views.update(this.model.get('_colorScale'));
68-
},
69-
this
70-
);
7163
}
7264
}

0 commit comments

Comments
 (0)