-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathMopedIllustration.qml
More file actions
61 lines (53 loc) · 1.92 KB
/
Copy pathMopedIllustration.qml
File metadata and controls
61 lines (53 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import QtQuick
import QtQuick.Shapes
import qs.Commons
import "assets/MopedPaths.js" as MopedPaths
Item {
id: root
property color strokeColor: Color.accent
property color backgroundColor: Color.background
property real strokeWidth: Math.max(1, Style.spaceReal(2))
// The source encodes its blue bands at roughly six SVG units. Expand those
// bands only by the amount needed to reach Okomart's live interface stroke.
readonly property real encodedLineWidth: 6
readonly property real sourcePadding: 4
readonly property real designWidth: MopedPaths.artWidth + sourcePadding * 2
readonly property real designHeight: MopedPaths.artHeight + sourcePadding * 2
readonly property real artScale: Math.min(
width / designWidth, height / designHeight)
readonly property real lineworkStrokeWidth:
artScale > 0
? Math.max(0, strokeWidth / artScale - encodedLineWidth)
: 0
implicitWidth: Style.space(168)
implicitHeight: implicitWidth * designHeight / designWidth
clip: true
opacity: 1.0
Shape {
x: -(MopedPaths.artX - root.sourcePadding) * root.artScale
y: -(MopedPaths.artY - root.sourcePadding) * root.artScale
width: MopedPaths.artX + MopedPaths.artWidth + root.sourcePadding
height: MopedPaths.artY + MopedPaths.artHeight + root.sourcePadding
scale: root.artScale
transformOrigin: Item.TopLeft
antialiasing: true
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: root.backgroundColor
fillRule: ShapePath.OddEvenFill
strokeColor: "transparent"
strokeWidth: 0
PathSvg { path: MopedPaths.bodyworkPath }
}
ShapePath {
fillColor: root.strokeColor
fillRule: ShapePath.OddEvenFill
strokeColor: root.strokeColor
strokeWidth: root.lineworkStrokeWidth
capStyle: ShapePath.RoundCap
joinStyle: ShapePath.RoundJoin
PathSvg { path: MopedPaths.lineworkPath }
}
}
Accessible.ignored: true
}