splendid keyboard detector

This commit is contained in:
mr 2024-07-17 17:45:47 +02:00
parent bef7f65363
commit 593f03648b
2 changed files with 5 additions and 7 deletions

View File

@ -98,7 +98,6 @@ class FlowElement extends ChangeNotifier {
);
bool isElement(Offset pos) {
print("${position.dx} <= ${pos.dx} <= ${position.dx + size.width}");
if (position.dx <= pos.dx && pos.dx <= position.dx + size.width) {
return position.dy <= pos.dy && pos.dy <= position.dy + size.height;
}

View File

@ -330,30 +330,28 @@ class DrawArrowState extends State<DrawArrow> {
((widget.arrowParams.endArrowPosition.y + 1) / 2)),
);
GlobalKey<GraphParamsWidgetState> key = GlobalKey<GraphParamsWidgetState>();
print("THERE");
return Stack( children : [
GraphParamsWidget(key: key, element: widget.srcElement, index: widget.index, comp: widget.flow),
RepaintBoundary(
child: Builder(
builder: (context) {
print(from);
print(to);
print(widget.pivots);
var painter = ArrowPainter(
connIndex: widget.index,
elementIndex: widget.flow.widget.dashboard.elements.indexOf(widget.srcElement),
fromID: "${widget.srcElement.id}_${widget.index}",
toID: "${widget.destElement.id}_${widget.index}",
isSelected: widget.flow.widget.dashboard.arrowsSelected.where(
(element) => element.fromID == "${widget.srcElement.id}_${widget.index}").isNotEmpty,
params: widget.arrowParams,
from: from, to: to,
pivots: widget.pivots.value,
);
if ( widget.flow.widget.dashboard.arrows.where(
(element) => element.fromID == "${widget.srcElement.id}${widget.index}").isEmpty) {
(element) => element.fromID == "${widget.srcElement.id}_${widget.index}").isEmpty) {
widget.flow.widget.dashboard.arrows.add(painter);
} else {
var i = widget.flow.widget.dashboard.arrows.indexWhere(
(element) => element.fromID == "${widget.srcElement.id}${widget.index}");
(element) => element.fromID == "${widget.srcElement.id}_${widget.index}");
painter.isSelected = widget.flow.widget.dashboard.arrows[i].isSelected;
widget.flow.widget.dashboard.arrows[i] = painter;
}
@ -519,6 +517,7 @@ class ArrowPainter extends CustomPainter {
if (params.style == ArrowStyle.curve) { drawCurve(canvas, paint);
} else if (params.style == ArrowStyle.segmented) { drawLine();
} else if (params.style == ArrowStyle.rectangular) { drawRectangularLine(canvas, paint); }
paint
..color = isSelected ? Colors.red : params.color
..style = PaintingStyle.stroke;