@@ -12,16 +12,25 @@ export default class Line extends Rectangle {
12
12
drawOnCanvas(canvas: Canvas) {
13
13
const availableWidth = layout.toDevicePixels(canvas.getWidth());
14
14
const availableHeight = layout.toDevicePixels(canvas.getHeight());
15
+ const marginLeft = this.marginLeft?layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.marginLeft, 0, availableWidth)):0;
16
+ const marginTop = this.marginTop?layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.marginTop, 0, availableHeight)):0;
17
+ const marginRight = this.marginRight?layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.marginRight, 0, availableWidth)):0;
18
+ const marginBottom = this.marginBottom?layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.marginBottom, 0, availableHeight)):0;
15
19
canvas.drawLine(
16
- layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.startX, 0, availableWidth)),
17
- layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.startY, 0, availableHeight)),
18
- layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.stopX, 0, availableWidth)),
19
- layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.stopY, 0, availableHeight)),
20
+ layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.startX, 0, availableWidth)) + marginLeft ,
21
+ layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.startY, 0, availableHeight)) + marginTop ,
22
+ layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.stopX, 0, availableWidth)) - marginRight - marginLeft ,
23
+ layout.toDeviceIndependentPixels(PercentLength.toDevicePixels(this.stopY, 0, availableHeight)) - marginBottom - marginTop ,
20
24
this.paint
21
25
);
22
26
}
23
- @percentLengthProperty startX: PercentLength = 0;
24
- @percentLengthProperty startY: PercentLength = 0;
25
- @percentLengthProperty stopX: PercentLength = 0;
26
- @percentLengthProperty stopY: PercentLength = 0;
27
+ @percentLengthProperty({ nonPaintProp: true }) startX: PercentLength = 0;
28
+ @percentLengthProperty({ nonPaintProp: true }) startY: PercentLength = 0;
29
+ @percentLengthProperty({ nonPaintProp: true }) stopX: PercentLength = 0;
30
+ @percentLengthProperty({ nonPaintProp: true }) stopY: PercentLength = 0;
31
+
32
+ @percentLengthProperty({ nonPaintProp: true }) marginLeft: PercentLength;
33
+ @percentLengthProperty({ nonPaintProp: true }) marginRight: PercentLength;
34
+ @percentLengthProperty({ nonPaintProp: true }) marginTop: PercentLength;
35
+ @percentLengthProperty({ nonPaintProp: true }) marginBottom: PercentLength;
27
36
}
0 commit comments