Skip to content

Commit d34c941

Browse files
committed
finished knob asset management
1 parent 0234415 commit d34c941

5 files changed

Lines changed: 164 additions & 45 deletions

File tree

ui/src/app/app.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
<eqm-tooltip-container></eqm-tooltip-container>
3131
</div>
3232
-->
33-
<div style="background-color: white; padding: 20px;">
33+
<div style="background-color: #2C2C2E; padding: 20px">
3434
<eqm-knob size="large"></eqm-knob>
35-
<!-- <eqm-knob size="medium"></eqm-knob>
36-
<eqm-knob size="small"></eqm-knob> -->
35+
<eqm-knob size="medium"></eqm-knob>
36+
<eqm-knob size="small"></eqm-knob>
3737
</div>

ui/src/app/app.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ export class AppComponent implements OnInit, AfterContentInit {
3939
) { }
4040

4141
async ngOnInit () {
42-
this.sync()
43-
this.analytics.send()
42+
// this.sync()
43+
// this.analytics.send()
4444
}
4545

4646
async ngAfterContentInit () {
47-
await this.utils.delay(this.animationDuration)
48-
this.syncDimensions()
49-
this.startDimensionsSync()
50-
this.loaded = true
47+
// await this.utils.delay(this.animationDuration)
48+
// this.syncDimensions()
49+
// this.startDimensionsSync()
50+
// this.loaded = true
5151
}
5252

5353
async sync () {

ui/src/app/modules/eqmac-components/components/knob/knob.component.html

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,42 @@
88
<div class="slot"></div>
99
<div class="body"></div>
1010
<div class="cap">
11-
<svg width="0" height="0">
11+
<svg width="58px" height="58px">
1212
<defs>
13-
<clipPath id="clip-path" clipPathUnits="objectBoundingBox" transform="scale(0.0076)">
14-
<path d="M125.07,36.7c-2.58,10.76-0.32,20.4,6.79,28.9c0,0.07,0.01,0.14,0.01,0.21c0,10.35-2.4,20.13-6.66,28.84
15-
c-9.75,4.46-15.77,11.95-18.06,22.51c-8.02,6.42-17.57,11.02-28.03,13.14c-8.78-4.19-17.56-4.19-26.35,0
16-
c-10.45-2.11-20-6.7-28.02-13.12c-2.28-10.58-8.32-18.09-18.1-22.55C2.4,85.93,0,76.15,0,65.81c0-0.06,0-0.11,0-0.17
17-
c7.14-8.52,9.41-18.18,6.81-28.97C11.52,27.18,18.44,19,26.9,12.78c9.12-0.2,16.65-3.77,22.59-10.71C54.75,0.72,60.26,0,65.93,0
18-
c5.69,0,11.21,0.72,16.47,2.07c5.94,6.93,13.46,10.5,22.56,10.71C113.44,19,120.37,27.2,125.07,36.7z"/>
13+
<clipPath id="large-knob-cap-clip-path" clipPathUnits="objectBoundingBox" [ngStyle]="getLargeCapClipPathStyle()">
14+
<path d="M0.95,0.28C0.93,0.36,0.95,0.43,1,0.5c0,0,0,0,0,0c0,0.08-0.02,0.15-0.05,0.22C0.88,0.75,0.83,0.81,0.81,0.89
15+
C0.75,0.94,0.68,0.97,0.6,0.99c-0.07-0.03-0.13-0.03-0.2,0c-0.08-0.02-0.15-0.05-0.21-0.1C0.17,0.81,0.12,0.75,0.05,0.72
16+
C0.02,0.65,0,0.58,0,0.5c0,0,0,0,0,0c0.05-0.06,0.07-0.14,0.05-0.22C0.09,0.21,0.14,0.14,0.2,0.1c0.07,0,0.13-0.03,0.17-0.08
17+
C0.42,0.01,0.46,0,0.5,0c0.04,0,0.09,0.01,0.12,0.02C0.67,0.07,0.73,0.1,0.8,0.1C0.86,0.14,0.91,0.21,0.95,0.28z"/>
1918
</clipPath>
2019
</defs>
2120
</svg>
22-
<div class="body"></div>
23-
<img class="inner-line" src="assets/knobs/large/cap-inner-line.svg" onload="SVGInject(this)"/>
24-
<div class="pointer"></div>
21+
<div class="cap-body"></div>
22+
<div class="indicator" [ngStyle]="getLargeCapIndicatorStyle()">
23+
<img class="inner-line" src="assets/knobs/large/cap-inner-line.svg" onload="SVGInject(this)"/>
24+
<div class="pointer"></div>
25+
</div>
2526
</div>
2627
</div>
2728

2829
<!-- Medium -->
2930
<div *ngIf="size === 'medium'" class="knob medium">
30-
<img src="assets/knobs/medium/scale.svg" />
31-
<div class="cap">
32-
<img src="assets/knobs/medium/cap.svg" />
31+
<img class="scale" src="assets/knobs/medium/scale.svg" onload="SVGInject(this)" />
32+
<div class="slot"></div>
33+
<div class="body"></div>
34+
<div class="cap" [ngStyle]="getMediumCapIndicatorStyle()">
35+
<img src="assets/knobs/medium/cap.svg" onload="SVGInject(this)" />
3336
</div>
3437
</div>
3538

3639
<!-- Small -->
3740
<div *ngIf="size === 'small'" class="knob small">
38-
<img src="assets/knobs/small/scale.svg" />
39-
<div class="cap">
40-
<img src="assets/knobs/small/cap.svg" />
41+
<img class="scale" src="assets/knobs/small/scale.svg" onload="SVGInject(this)" />
42+
<div class="slot"></div>
43+
<div class="body"></div>
44+
45+
<div class="cap" [ngStyle]="getSmallCapIndicatorStyle()">
46+
<img src="assets/knobs/small/cap.svg" onload="SVGInject(this)" />
4147
</div>
4248
</div>
4349
</div>

ui/src/app/modules/eqmac-components/components/knob/knob.component.scss

Lines changed: 100 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
.container {
2424

25+
display: inline-block;
2526
.knob {
2627
position: relative;
2728
}
@@ -31,13 +32,13 @@
3132
box-shadow: 0 1px $blur $size #000,
3233
0 -1px $blur $size #FFF9;
3334
}
34-
35-
@include size(80px);
35+
@include size(90px);
36+
3637
.scale {
3738
@include size(80px);
3839
@include center();
3940
fill: $accent;
40-
top: 41.5%;
41+
top: 43%;
4142
}
4243

4344
.slot {
@@ -67,35 +68,117 @@
6768
.cap {
6869
@include center();
6970
@include size(58px);
70-
filter: drop-shadow(0 -0.2px 0px #FFF5)
71+
filter: drop-shadow(0 -0.1px 0px #FFF3)
7172
drop-shadow(0 1px 0.5px black);
7273

73-
.body {
74+
#large-knob-cap-clip-path {
75+
@include size(58px);
76+
transform-origin: 50% 50%;
77+
}
78+
79+
.cap-body {
7480
@include center();
7581
@include size(58px);
7682
// @include shadow(2px, 0px);
7783

7884
background-image: linear-gradient(to bottom, #51555A, #3C4045);
79-
clip-path: url('#clip-path');
85+
clip-path: url('#large-knob-cap-clip-path');
8086
}
8187

82-
.inner-line {
88+
.indicator {
8389
@include center();
8490
@include size(40px);
85-
fill: darken(#2F3336, 5%);
91+
.inner-line {
92+
@include center();
93+
@include size(40px);
94+
fill: darken(#2F3336, 5%);
95+
}
96+
97+
.pointer {
98+
@include size(5px);
99+
@include circle();
100+
position: absolute;
101+
top: -4%;
102+
left: 50%;
103+
transform: translate(-50%, 0);
104+
background-color: $accent;
105+
}
86106
}
107+
108+
}
109+
}
87110

88-
.pointer {
89-
@include center();
90-
@include size(6px);
91-
@include circle();
92-
top: 17%;
93-
background-color: $accent;
94-
}
111+
.medium {
112+
@include size(70px);
113+
114+
.scale {
115+
@include size(62px);
116+
@include center();
117+
fill: $accent;
118+
// top: 41.5%;
119+
}
120+
121+
.slot {
122+
@include center();
123+
@include size(48px);
124+
@include circle();
125+
background-color: #3F4346;
126+
box-shadow: 0 3px 5px 2px #0009;
127+
128+
}
129+
130+
.body {
131+
@include center();
132+
@include size(38px);
133+
@include circle();
134+
135+
box-shadow: 0 0 2px 0.5px #FFF2;
136+
137+
background-color: #3D4244;
95138
}
139+
140+
.cap {
141+
@include center();
142+
@include size(38px);
143+
fill: $accent;
144+
}
145+
96146
}
97147

98-
.medium {}
148+
.small {
149+
@include size(50px);
150+
151+
.scale {
152+
@include size(40px);
153+
@include center();
154+
fill: $accent;
155+
// top: 41.5%;
156+
}
157+
158+
.slot {
159+
@include center();
160+
@include size(34px);
161+
@include circle();
162+
background-color: #3F4346;
163+
box-shadow: 0 2px 5px 2px #0009;
164+
165+
}
99166

100-
.small {}
167+
.body {
168+
@include center();
169+
@include size(27px);
170+
@include circle();
171+
172+
box-shadow: 0 0 2px 0.5px #FFF2;
173+
174+
background-color: #3D4244;
175+
}
176+
177+
.cap {
178+
@include center();
179+
@include size(24px);
180+
fill: $accent;
181+
}
182+
183+
}
101184
}

ui/src/app/modules/eqmac-components/components/knob/knob.component.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
EventEmitter,
77
ViewChild,
88
HostListener,
9-
HostBinding
9+
HostBinding,
10+
ElementRef
1011
} from '@angular/core'
1112

1213
import { UtilitiesService } from '../../services/utilities.service'
@@ -48,7 +49,8 @@ export class KnobComponent implements OnInit {
4849
private continueAnimation = false
4950
private dragStartDegr = 0
5051

51-
@ViewChild('container', { static: true }) container: HTMLDivElement
52+
@ViewChild('container', { static: true }) containerRef: ElementRef
53+
container: HTMLDivElement
5254

5355
private _value = 0
5456
@Output() valueChange = new EventEmitter<number>()
@@ -90,6 +92,7 @@ export class KnobComponent implements OnInit {
9092
constructor (private utils: UtilitiesService) {}
9193

9294
async ngOnInit () {
95+
this.container = this.containerRef.nativeElement
9396
this.setKnobImage(this._value)
9497
}
9598

@@ -181,6 +184,33 @@ export class KnobComponent implements OnInit {
181184
}
182185
}
183186

187+
largeCapMaxAngle = 130
188+
getLargeCapClipPathStyle () {
189+
return {
190+
transform: `rotate(${this.utils.mapValue(this.value, this.min, this.max, -this.largeCapMaxAngle, this.largeCapMaxAngle)}deg)`
191+
}
192+
}
193+
194+
getLargeCapIndicatorStyle () {
195+
return {
196+
transform: `translate(-50%, -50%) rotate(${this.utils.mapValue(this.value, this.min, this.max, -this.largeCapMaxAngle, this.largeCapMaxAngle)}deg)`
197+
}
198+
}
199+
200+
mediumCapMaxAngle = 135
201+
getMediumCapIndicatorStyle () {
202+
return {
203+
transform: `translate(-50%, -50%) rotate(${this.utils.mapValue(this.value, this.min, this.max, -this.mediumCapMaxAngle, this.mediumCapMaxAngle)}deg)`
204+
}
205+
}
206+
207+
smallCapMaxAngle = 135
208+
getSmallCapIndicatorStyle () {
209+
return {
210+
transform: `translate(-50%, -50%) rotate(${this.utils.mapValue(this.value, this.min, this.max, -this.smallCapMaxAngle, this.smallCapMaxAngle)}deg)`
211+
}
212+
}
213+
184214
async animateKnob (from: number, to: number) {
185215
from = this.clampValue(from)
186216
to = this.clampValue(to)
@@ -209,7 +239,7 @@ export class KnobComponent implements OnInit {
209239
const knobCenterX = (this.container.clientWidth + this.padding * 2) / 2
210240
const knobCenterY = (this.container.clientHeight + this.padding * 2) / 2
211241
const rads = Math.atan2(coords.x - knobCenterX, coords.y - knobCenterY)
212-
return rads * 50
242+
return rads * 100
213243
}
214244

215245
private getDistanceFromCenterOfElementAndEvent (event) {

0 commit comments

Comments
 (0)