@@ -10,11 +10,11 @@ import { MetricHandler } from 'metric_handler';
10
10
import { $GF , GFTimer , GFLog , GFPlugin , GFCONSTANT } from 'globals_class' ;
11
11
import grafana from 'grafana_func' ;
12
12
import { defaults as _defaults , cloneDeep as _cloneDeep } from 'lodash' ;
13
- import { InteractiveMap } from 'mapping_class' ;
13
+ // import { InteractiveMap } from 'mapping_class';
14
14
import { GFDrawio } from 'drawio_base' ;
15
15
16
16
// Debug
17
- const DEBUG = false ;
17
+ const DEBUG = true ;
18
18
const _log = ( ...args : any ) => {
19
19
DEBUG && console . log ( ...args ) ;
20
20
} ;
@@ -40,7 +40,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
40
40
rulesHandler : RulesHandler | undefined ;
41
41
flowchartHandler : FlowchartHandler | undefined ;
42
42
metricHandler : MetricHandler | undefined ;
43
- onMapping : InteractiveMap ;
43
+ onMapping = false ;
44
44
uid : string = $GF . genUid ( this . constructor . name ) ;
45
45
graphHoverTimer : GFTimer | undefined = undefined ;
46
46
mouseIn = false ;
@@ -69,7 +69,7 @@ class FlowchartCtrl extends MetricsPanelCtrl {
69
69
this . changedSource = true ;
70
70
this . changedData = true ;
71
71
this . changedOptions = true ;
72
- this . onMapping = new InteractiveMap ( ) ;
72
+ // this.onMapping = new InteractiveMap();
73
73
this . parentDiv = document . createElement ( 'div' ) ;
74
74
this . flowchartsDiv = document . createElement ( 'div' ) ;
75
75
// this.uid = $GF.genUid();
@@ -129,11 +129,15 @@ class FlowchartCtrl extends MetricsPanelCtrl {
129
129
this . $gf . events . connect ( 'debug_asked' , this , this . _on_global_debug_asked . bind ( this ) ) ;
130
130
this . $gf . events . connect ( 'panel_closed' , this , this . _on_global_panel_closed . bind ( this ) ) ;
131
131
this . $gf . events . connect ( 'editmode_closed' , this , this . _on_global_editmode_closed . bind ( this ) ) ;
132
+ this . $gf . events . connect ( 'mapping_enabled' , this , this . _on_global_mapping_enabled . bind ( this ) ) ;
133
+ this . $gf . events . connect ( 'mapping_disabled' , this , this . _on_global_mapping_disabled . bind ( this ) ) ;
132
134
}
133
135
134
136
_eventsDisconnect ( ) {
135
137
this . $gf . events . disconnect ( 'debug_asked' , this ) ;
136
138
this . $gf . events . disconnect ( 'panel_closed' , this ) ;
139
+ this . $gf . events . disconnect ( 'mapping_enabled' , this ) ;
140
+ this . $gf . events . disconnect ( 'mapping_disabled' , this ) ;
137
141
}
138
142
139
143
init_handlers ( ) {
@@ -218,6 +222,75 @@ class FlowchartCtrl extends MetricsPanelCtrl {
218
222
return false ;
219
223
}
220
224
225
+ link ( scope : any , elem : any , attrs : any , ctrl : any ) {
226
+ this . $panelElem = elem ;
227
+ const $section = this . $panelElem . find ( '#flowcharting-section' ) ;
228
+ this . parentDiv = $section [ 0 ] ;
229
+ const $flowchartsDiv = $section . find ( '#flowcharting-panel-content' ) ;
230
+ this . flowchartsDiv = $flowchartsDiv [ 0 ] ;
231
+ // this.onMapping.setContainer(this.flowchartsDiv);
232
+ this . notify ( 'Initialisation MXGRAPH/DRAW.IO Libs' ) ;
233
+
234
+ // MxGraph Init
235
+ this . notify ( 'Load configuration' ) ;
236
+ if ( this . panel . gf_isEdited ) {
237
+ delete this . panel . gf_isEdited ;
238
+ }
239
+ GFDrawio . init ( ) ;
240
+ this . init_ctrl ( ) ;
241
+ if ( this . panel . version !== GFPlugin . getVersion ( ) ) {
242
+ //TODO : Reactive this
243
+ // this.notify(
244
+ // `The plugin version has changed, save the dashboard to optimize loading : ${
245
+ // this.panel.version
246
+ // } <> ${$GF.plugin.getVersion()}`
247
+ // );
248
+ }
249
+ this . clearNotify ( ) ;
250
+ this . panel . version = this . version ;
251
+ // Open is edit mode
252
+ if ( this . panel . isEditing === true ) {
253
+ this . panel . gf_isEdited = true ;
254
+ }
255
+ }
256
+
257
+ isMouseInPanel ( ) : boolean {
258
+ return this . mouseIn ;
259
+ }
260
+
261
+ displayMultiCursor ( ) : boolean {
262
+ if ( this . flowchartHandler ) {
263
+ return this . flowchartHandler . isMultiFlowcharts ( ) ;
264
+ }
265
+ return false ;
266
+ }
267
+
268
+ displayFirstCursor ( ) : boolean {
269
+ if ( this . flowchartHandler ) {
270
+ return ! this . flowchartHandler . isCurrentfirst ( ) ;
271
+ }
272
+ return false ;
273
+ }
274
+
275
+ displayLastCursor ( ) : boolean {
276
+ if ( this . flowchartHandler ) {
277
+ return ! this . flowchartHandler . isCurrentLast ( ) ;
278
+ }
279
+ return false ;
280
+ }
281
+
282
+ displayNextFlowchart ( ) {
283
+ if ( this . flowchartHandler ) {
284
+ this . flowchartHandler . setNextFlowchart ( ) ;
285
+ }
286
+ }
287
+
288
+ displayPreviousFlowchart ( ) {
289
+ if ( this . flowchartHandler ) {
290
+ this . flowchartHandler . setPreviousFlowchart ( ) ;
291
+ }
292
+ }
293
+
221
294
//###########################################################################
222
295
//### EVENTS
223
296
//###########################################################################
@@ -314,79 +387,20 @@ class FlowchartCtrl extends MetricsPanelCtrl {
314
387
return ;
315
388
}
316
389
317
- link ( scope : any , elem : any , attrs : any , ctrl : any ) {
318
- this . $panelElem = elem ;
319
- const $section = this . $panelElem . find ( '#flowcharting-section' ) ;
320
- this . parentDiv = $section [ 0 ] ;
321
- const $flowchartsDiv = $section . find ( '#flowcharting-panel-content' ) ;
322
- this . flowchartsDiv = $flowchartsDiv [ 0 ] ;
323
- this . onMapping . setContainer ( this . flowchartsDiv ) ;
324
- this . notify ( 'Initialisation MXGRAPH/DRAW.IO Libs' ) ;
325
-
326
- // MxGraph Init
327
- this . notify ( 'Load configuration' ) ;
328
- if ( this . panel . gf_isEdited ) {
329
- delete this . panel . gf_isEdited ;
330
- }
331
- GFDrawio . init ( ) ;
332
- this . init_ctrl ( ) ;
333
- if ( this . panel . version !== GFPlugin . getVersion ( ) ) {
334
- //TODO : Reactive this
335
- // this.notify(
336
- // `The plugin version has changed, save the dashboard to optimize loading : ${
337
- // this.panel.version
338
- // } <> ${$GF.plugin.getVersion()}`
339
- // );
340
- }
341
- this . clearNotify ( ) ;
342
- this . panel . version = this . version ;
343
- // Open is edit mode
344
- if ( this . panel . isEditing === true ) {
345
- this . panel . gf_isEdited = true ;
346
- }
347
- }
348
-
349
- isMouseInPanel ( ) : boolean {
350
- return this . mouseIn ;
351
- }
352
-
353
- displayMultiCursor ( ) : boolean {
354
- if ( this . flowchartHandler ) {
355
- return this . flowchartHandler . isMultiFlowcharts ( ) ;
356
- }
357
- return false ;
390
+ private _on_global_mapping_enabled ( ) {
391
+ _log ( '📬' , this . constructor . name , this . uid , '_on_global_mapping_enabled' ) ;
392
+ this . onMapping = true ;
393
+ this . flowchartsDiv . style . cursor = `url("${ GFPlugin . getStaticPath ( ) } cursor-marker.svg") 8 16, crosshair` ;
394
+ this . flowchartsDiv . scrollIntoView ( ) ;
395
+ this . flowchartsDiv . focus ( ) ;
358
396
}
359
397
360
- displayFirstCursor ( ) : boolean {
361
- if ( this . flowchartHandler ) {
362
- return ! this . flowchartHandler . isCurrentfirst ( ) ;
363
- }
364
- return false ;
398
+ private _on_global_mapping_disabled ( ) {
399
+ _log ( '📬' , this . constructor . name , this . uid , '_on_global_mapping_disabled' ) ;
400
+ this . onMapping = false ;
401
+ this . flowchartsDiv . style . cursor = 'auto' ;
365
402
}
366
403
367
- displayLastCursor ( ) : boolean {
368
- if ( this . flowchartHandler ) {
369
- return ! this . flowchartHandler . isCurrentLast ( ) ;
370
- }
371
- return false ;
372
- }
373
-
374
- displayNextFlowchart ( ) {
375
- if ( this . flowchartHandler ) {
376
- this . flowchartHandler . setNextFlowchart ( ) ;
377
- }
378
- }
379
-
380
- displayPreviousFlowchart ( ) {
381
- if ( this . flowchartHandler ) {
382
- this . flowchartHandler . setPreviousFlowchart ( ) ;
383
- }
384
- }
385
-
386
- //
387
- // EVENTS
388
- //
389
-
390
404
$onDestroy ( ) {
391
405
// $GF.destroy();
392
406
GFTimer . stop ( ) ;
0 commit comments