|
|
@ -115,7 +115,40 @@ function Graph2d (container, items, groups, options) { |
|
|
|
this.dom.root.oncontextmenu = function (event) { |
|
|
|
me.emit('contextmenu', me.getEventProperties(event)) |
|
|
|
}; |
|
|
|
|
|
|
|
//Single time autoscale/fit
|
|
|
|
this.initialFitDone = false; |
|
|
|
this.on('changed', function (){ |
|
|
|
if (me.itemsData == null) return; |
|
|
|
if (!me.initialFitDone && !me.options.rollingMode) { |
|
|
|
me.initialFitDone = true; |
|
|
|
if (me.options.start != undefined || me.options.end != undefined) { |
|
|
|
if (me.options.start == undefined || me.options.end == undefined) { |
|
|
|
var range = me.getItemRange(); |
|
|
|
} |
|
|
|
|
|
|
|
var start = me.options.start != undefined ? me.options.start : range.min; |
|
|
|
var end = me.options.end != undefined ? me.options.end : range.max; |
|
|
|
me.setWindow(start, end, {animation: false}); |
|
|
|
} else { |
|
|
|
me.fit({animation: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!me.initialDrawDone && (me.initialRangeChangeDone || (!me.options.start && !me.options.end) |
|
|
|
|| me.options.rollingMode)) { |
|
|
|
me.initialDrawDone = true; |
|
|
|
me.itemSet.initialDrawDone = true; |
|
|
|
me.dom.root.style.visibility = 'visible'; |
|
|
|
me.dom.loadingScreen.parentNode.removeChild(me.dom.loadingScreen); |
|
|
|
if (me.options.onInitialDrawComplete) { |
|
|
|
setTimeout(() => { |
|
|
|
return me.options.onInitialDrawComplete(); |
|
|
|
}, 0) |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
// apply options
|
|
|
|
if (options) { |
|
|
|
this.setOptions(options); |
|
|
|