Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63117546
guidegrid.dart
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 17, 21:33
Size
1 KB
Mime Type
text/x-c++
Expires
Sun, May 19, 21:33 (2 d)
Engine
blob
Format
Raw Data
Handle
17733970
Attached To
R10646 Orchestration
guidegrid.dart
View Options
import 'package:flutter/material.dart';
class GuideGrid extends CustomPainter {
Paint _paintBlue;
Paint _paintRed;
double _progress;
Offset beginpath;
Offset endpath;
Offset origin;
var step = 0.0;
List<double> celluloxposition;
List<double> celluloyposition;
double coeffScreenMapHeight;
double coeffScreenMapWidth;
double xaxis = 750;
double yaxis = 80;
int axisX;
int axisY;
var steps = [0.0, 80.0, 157.0, 235.0, 312.0, 389.0, 467.0];
GuideGrid(this.origin, this.step, this.coeffScreenMapWidth,
this.coeffScreenMapHeight, this.celluloxposition, this.celluloyposition) {
_paintBlue = Paint()
..color = Colors.blue
..strokeWidth = 1.0
..style = PaintingStyle.fill;
_paintRed = Paint()
..color = Colors.red
..strokeWidth = 1.0
..style = PaintingStyle.fill;
axisX =
((celluloxposition[0] - origin.dx / coeffScreenMapWidth) ~/ step) - 1;
axisY =
((origin.dy - celluloyposition[1] / coeffScreenMapHeight) ~/ step) + 1;
if (axisX < 0) axisX = 0;
if (axisY < 0) axisY = 0;
if (axisX > 6) axisX = 6;
if (axisY > 6) axisY = 6;
}
@override
void paint(Canvas canvas, Size size) {
canvas.drawCircle(
Offset(origin.dx + steps[axisX], origin.dy), 11.0, _paintRed);
canvas.drawCircle(
Offset(origin.dx, origin.dy - steps[axisY]), 11.0, _paintBlue);
canvas.drawLine(
Offset(celluloxposition[0] * coeffScreenMapWidth,
celluloyposition[1] * coeffScreenMapHeight),
Offset(celluloxposition[0] * coeffScreenMapWidth,
xaxis * coeffScreenMapHeight),
_paintRed);
canvas.drawLine(
Offset(celluloxposition[0] * coeffScreenMapWidth,
celluloyposition[1] * coeffScreenMapHeight),
Offset(yaxis * coeffScreenMapWidth,
celluloyposition[1] * coeffScreenMapHeight),
_paintBlue);
}
@override
bool shouldRepaint(GuideGrid oldDelegate) {
return oldDelegate._progress != _progress;
}
}
Event Timeline
Log In to Comment