drawInteractivePoint method
void
drawInteractivePoint(
- Canvas canvas,
- Paint paint
)
Implementation
void drawInteractivePoint(Canvas canvas, Paint paint) {
if (isSelected) {
for (var resizePoint in resizePoints) {
paint.color = Colors.blue;
paint.style = PaintingStyle.fill;
canvas.drawCircle(
resizePoint.offset,
5,
paint,
);
}
for (var rotatePoint in rotatePoints) {
paint.color = Colors.blue;
paint.style = PaintingStyle.stroke;
paint.strokeWidth = 1;
canvas.drawLine(
rotatePoint.offset,
rotatePoint.anchorOffset,
paint,
);
const icon = Icons.rotate_right;
TextPainter textPainter = TextPainter(textDirection: TextDirection.ltr);
textPainter.text = TextSpan(
text: String.fromCharCode(icon.codePoint),
style: TextStyle(
color: Colors.blue,
fontSize: 20,
fontFamily: icon.fontFamily,
package: icon.fontPackage,
),
);
textPainter.layout();
textPainter.paint(canvas, rotatePoint.offset.translate(-10, -10));
}
for (var removePoint in removePoints) {
const icon = Icons.remove_circle;
TextPainter textPainter = TextPainter(textDirection: TextDirection.ltr);
textPainter.text = TextSpan(
text: String.fromCharCode(icon.codePoint),
style: TextStyle(
color: Colors.red,
fontSize: 20,
fontFamily: icon.fontFamily,
package: icon.fontPackage,
),
);
textPainter.layout();
textPainter.paint(canvas, removePoint.translate(-10, -10));
}
}
}