@@ -62,6 +62,10 @@ function Selection(teleperiod) {
62
62
if ( selection . dtstart . getTime ( ) < pointerDate . getTime ( ) ) {
63
63
selection . dtend = pointerDate ;
64
64
65
+ if ( selection . isValid ( ) ) {
66
+ selection . highlightPeriods ( ) ;
67
+ }
68
+
65
69
if ( selection . teleperiod . settings . onUpdated ) {
66
70
selection . teleperiod . settings . onUpdated ( selection ) ;
67
71
}
@@ -204,7 +208,26 @@ function Selection(teleperiod) {
204
208
return rect ;
205
209
} ;
206
210
211
+ /**
212
+ * Remove all overlay of the selection
213
+ *
214
+ */
215
+ this . removeOverlay = function ( )
216
+ {
217
+ for ( var i = 0 ; i < selection . overlayItems . length ; i ++ ) {
218
+ selection . overlayItems [ i ] . remove ( ) ;
219
+ }
220
+
221
+ selection . overlayItems = [ ] ;
207
222
223
+ } ;
224
+
225
+
226
+ /**
227
+ * Apply or remove a classname on all averlay items
228
+ * @param string classname
229
+ * @param bool status
230
+ */
208
231
this . setOverlayClassed = function ( classname , status )
209
232
{
210
233
for ( var i = 0 ; i < selection . overlayItems . length ; i ++ ) {
@@ -213,13 +236,13 @@ function Selection(teleperiod) {
213
236
} ;
214
237
215
238
239
+ /**
240
+ * Remove existing overlay
241
+ * and fire the callback
242
+ */
216
243
this . resetOverlay = function ( )
217
244
{
218
- for ( var i = 0 ; i < selection . overlayItems . length ; i ++ ) {
219
- selection . overlayItems [ i ] . remove ( ) ;
220
- }
221
-
222
- selection . overlayItems = [ ] ;
245
+ selection . removeOverlay ( ) ;
223
246
224
247
if ( selection . teleperiod . settings . onUpdated ) {
225
248
selection . teleperiod . settings . onUpdated ( selection ) ;
0 commit comments