RenderGraph constructor
RenderGraph({})
Implementation
RenderGraph({required Json spec, List<Json> data = const [], Json? view, bool interactive = true})
: _specJson = spec,
_data = data,
_view = view,
_interactive = interactive {
engine = GraphEngine(GraphSpec.fromJson(spec), data: data, view: view)
..onNeedHistory = ((view) => _later(() => onNeedHistory?.call(view)))
..addListener(_onEngine);
_fling = AnimationController.unbounded(vsync: this)
..addListener(() {
final d = _fling.value - _flung;
_flung = _fling.value;
engine.panBy(d);
});
_pulse = AnimationController(vsync: this, duration: const Duration(milliseconds: 1600))..addListener(markNeedsPaint);
_morph = AnimationController(vsync: this)
..addListener(() => engine.morphTo(Curves.easeInOut.transform(_morph.value)));
_tween = AnimationController(vsync: this)
..addListener(() => engine.tweenTo(Curves.easeOutCubic.transform(_tween.value)));
_scaleGesture = ScaleGestureRecognizer(debugOwner: this)
..onStart = _start
..onUpdate = _update
..onEnd = _end;
_doubleTapGesture = DoubleTapGestureRecognizer(debugOwner: this)
..onDoubleTapDown = ((d) => _doubleTapAt = d.localPosition)
..onDoubleTap = _doubleTap;
_tapGesture = TapGestureRecognizer(debugOwner: this)..onTapUp = (d) => engine.tap(d.localPosition);
_longPressGesture = LongPressGestureRecognizer(debugOwner: this)
..onLongPressStart = ((d) {
_pressing = true;
engine.setCursor(d.localPosition);
})
..onLongPressMoveUpdate = ((d) => _pressing ? engine.setCursor(d.localPosition) : null)
..onLongPressEnd = ((_) {
if (!_pressing) return;
_pressing = false;
engine.setCursor(null);
});
}