fix: mark & active brick type
This commit is contained in:
parent
fad258a537
commit
3d466953d2
|
@ -39,7 +39,7 @@ type roomTableData struct {
|
||||||
currentPerson rooms.PersonId
|
currentPerson rooms.PersonId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (room *roomTableData)Persons() []personData {
|
func (room *roomTableData) Persons() []personData {
|
||||||
total := room.Total()
|
total := room.Total()
|
||||||
persons := make([]personData, 0, total)
|
persons := make([]personData, 0, total)
|
||||||
currentPersonIndex := slices.Index(room.Paricipants, room.currentPerson)
|
currentPersonIndex := slices.Index(room.Paricipants, room.currentPerson)
|
||||||
|
@ -51,10 +51,10 @@ func (room *roomTableData)Persons() []personData {
|
||||||
}
|
}
|
||||||
return persons
|
return persons
|
||||||
}
|
}
|
||||||
func (r *roomTableData)Total() int {
|
func (r *roomTableData) Total() int {
|
||||||
return len(r.Paricipants)
|
return len(r.Paricipants)
|
||||||
}
|
}
|
||||||
func (r *roomTableData)Tangens() float64 {
|
func (r *roomTableData) Tangens() float64 {
|
||||||
total := r.Total()
|
total := r.Total()
|
||||||
if total == 2 {
|
if total == 2 {
|
||||||
return 1
|
return 1
|
||||||
|
@ -74,7 +74,7 @@ type arrowData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// arrow data - to draw SVG from current speaker to next speaker
|
// arrow data - to draw SVG from current speaker to next speaker
|
||||||
func (r *roomTableData)ArrowData() arrowData {
|
func (r *roomTableData) ArrowData() arrowData {
|
||||||
// TODO figure out size to be around the people
|
// TODO figure out size to be around the people
|
||||||
// and this is somewhat a win
|
// and this is somewhat a win
|
||||||
height, width := 150.0, 150.0
|
height, width := 150.0, 150.0
|
||||||
|
@ -92,8 +92,8 @@ func (r *roomTableData)ArrowData() arrowData {
|
||||||
endSector += total
|
endSector += total
|
||||||
}
|
}
|
||||||
radius := 50.0
|
radius := 50.0
|
||||||
startAngle := 90 + float64(startSector) * ( 360.0 / float64(total) )
|
startAngle := 90 + float64(startSector)*(360.0/float64(total))
|
||||||
endAngle := 90 + float64(endSector) * ( 360.0 / float64(total) )
|
endAngle := 90 + float64(endSector)*(360.0/float64(total))
|
||||||
// if need to draw full circle
|
// if need to draw full circle
|
||||||
if startSector == endSector {
|
if startSector == endSector {
|
||||||
startAngle += 3 // a bit forward
|
startAngle += 3 // a bit forward
|
||||||
|
@ -103,25 +103,25 @@ func (r *roomTableData)ArrowData() arrowData {
|
||||||
endAngleRad := endAngle * (math.Pi / float64(180))
|
endAngleRad := endAngle * (math.Pi / float64(180))
|
||||||
// endAngle is radius angle, so perpendicular gives direction of teh arrow
|
// endAngle is radius angle, so perpendicular gives direction of teh arrow
|
||||||
|
|
||||||
x1 := centerX + radius * math.Cos(startAngleRad)
|
x1 := centerX + radius*math.Cos(startAngleRad)
|
||||||
y1 := centerY + radius * math.Sin(startAngleRad)
|
y1 := centerY + radius*math.Sin(startAngleRad)
|
||||||
x2 := centerX + radius * math.Cos(endAngleRad)
|
x2 := centerX + radius*math.Cos(endAngleRad)
|
||||||
y2 := centerY + radius * math.Sin(endAngleRad)
|
y2 := centerY + radius*math.Sin(endAngleRad)
|
||||||
|
|
||||||
arrowAngleOffset := math.Pi / 4 // 45 degrees
|
arrowAngleOffset := math.Pi / 4 // 45 degrees
|
||||||
arrowPointDirection := endAngleRad - math.Pi / 2
|
arrowPointDirection := endAngleRad - math.Pi/2
|
||||||
arrowheadLen := 10.0
|
arrowheadLen := 10.0
|
||||||
arrowMinusAngle := arrowPointDirection - arrowAngleOffset
|
arrowMinusAngle := arrowPointDirection - arrowAngleOffset
|
||||||
arrowPlusAngle := arrowPointDirection + arrowAngleOffset
|
arrowPlusAngle := arrowPointDirection + arrowAngleOffset
|
||||||
arrowMinusEndX := x2 + arrowheadLen * math.Cos(arrowMinusAngle)
|
arrowMinusEndX := x2 + arrowheadLen*math.Cos(arrowMinusAngle)
|
||||||
arrowMinusEndY := y2 + arrowheadLen * math.Sin(arrowMinusAngle)
|
arrowMinusEndY := y2 + arrowheadLen*math.Sin(arrowMinusAngle)
|
||||||
arrowPlusEndX := x2 + arrowheadLen * math.Cos(arrowPlusAngle)
|
arrowPlusEndX := x2 + arrowheadLen*math.Cos(arrowPlusAngle)
|
||||||
arrowPlusEndY := y2 + arrowheadLen * math.Sin(arrowPlusAngle)
|
arrowPlusEndY := y2 + arrowheadLen*math.Sin(arrowPlusAngle)
|
||||||
|
|
||||||
// indicates that the shorter of the two possible arcs should be used.
|
// indicates that the shorter of the two possible arcs should be used.
|
||||||
largeArcFlag := 0
|
largeArcFlag := 0
|
||||||
//
|
//
|
||||||
if endAngleRad - startAngleRad > (math.Pi) {
|
if endAngleRad-startAngleRad > (math.Pi) {
|
||||||
// specifies that the longer arc should be chosen.
|
// specifies that the longer arc should be chosen.
|
||||||
largeArcFlag = 1
|
largeArcFlag = 1
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ func personDataFromRoom(room *roomTableData, pId rooms.PersonId) personData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pData personData)BricksForPerson() []brickState {
|
func (pData personData) BricksForPerson() []brickState {
|
||||||
var result = make([]brickState, 5)
|
var result = make([]brickState, 5)
|
||||||
for gesture := rooms.ChangeTopic; gesture <= rooms.Meta; gesture++ {
|
for gesture := rooms.ChangeTopic; gesture <= rooms.Meta; gesture++ {
|
||||||
// for index := rooms.Meta; index >= rooms.ChangeTopic; index-- {
|
// for index := rooms.Meta; index >= rooms.ChangeTopic; index-- {
|
||||||
|
@ -177,6 +177,8 @@ func (pData personData)BricksForPerson() []brickState {
|
||||||
// this results in iteration 4,3,2,1,0,255 wow
|
// this results in iteration 4,3,2,1,0,255 wow
|
||||||
templateType := "inactiveBrick"
|
templateType := "inactiveBrick"
|
||||||
switch {
|
switch {
|
||||||
|
case pData.IsRaised && pData.IsMark && gesture == pData.Raised:
|
||||||
|
templateType = "markAndRaisedBrick"
|
||||||
case pData.IsMark && gesture == pData.Mark:
|
case pData.IsMark && gesture == pData.Mark:
|
||||||
templateType = "markBrick"
|
templateType = "markBrick"
|
||||||
case pData.IsSpeaker && gesture == pData.Raised:
|
case pData.IsSpeaker && gesture == pData.Raised:
|
||||||
|
@ -225,6 +227,10 @@ func roomTemplatesPreview(
|
||||||
Id: rooms.PersonId(300),
|
Id: rooms.PersonId(300),
|
||||||
Name: "test person name 3",
|
Name: "test person name 3",
|
||||||
}
|
}
|
||||||
|
var person4 = rooms.Person{
|
||||||
|
Id: rooms.PersonId(400),
|
||||||
|
Name: "test person name 4",
|
||||||
|
}
|
||||||
aRoom := rooms.Room{
|
aRoom := rooms.Room{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
CurrentSpeaker: person3.Id,
|
CurrentSpeaker: person3.Id,
|
||||||
|
@ -232,18 +238,22 @@ func roomTemplatesPreview(
|
||||||
person1.Id: person1,
|
person1.Id: person1,
|
||||||
person2.Id: person2,
|
person2.Id: person2,
|
||||||
person3.Id: person3,
|
person3.Id: person3,
|
||||||
|
person4.Id: person4,
|
||||||
},
|
},
|
||||||
Paricipants: []rooms.PersonId{
|
Paricipants: []rooms.PersonId{
|
||||||
person1.Id,
|
person1.Id,
|
||||||
person2.Id,
|
person2.Id,
|
||||||
person3.Id,
|
person3.Id,
|
||||||
|
person4.Id,
|
||||||
},
|
},
|
||||||
ParticipantHands: map[rooms.PersonId]rooms.HandGesture{
|
ParticipantHands: map[rooms.PersonId]rooms.HandGesture{
|
||||||
person3.Id: rooms.ClarifyingQ,
|
person3.Id: rooms.ClarifyingQ,
|
||||||
person2.Id: rooms.Meta,
|
person2.Id: rooms.Meta,
|
||||||
|
person4.Id: rooms.ChangeTopic,
|
||||||
},
|
},
|
||||||
Marks: map[rooms.HandGesture]rooms.PersonId{
|
Marks: map[rooms.HandGesture]rooms.PersonId{
|
||||||
rooms.Expand: person1.Id,
|
rooms.Expand: person1.Id,
|
||||||
|
rooms.ChangeTopic: person4.Id,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,8 +628,8 @@ video {
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-cols-5 {
|
.grid-cols-6 {
|
||||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-rows-\[auto\2c 1fr\] {
|
.grid-rows-\[auto\2c 1fr\] {
|
||||||
|
|
|
@ -26,6 +26,14 @@
|
||||||
X
|
X
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ define "markAndRaisedBrick" }}
|
||||||
|
<div
|
||||||
|
class="h-[var(--brick-height)] w-20 border-[hsl(var(--brick-color))] border bg-[hsl(var(--brick-color))]/25 grid place-content-center font-bold text-[hsl(var(--brick-color))]/50"
|
||||||
|
style="--brick-color: var({{.}}); --brick-height: calc(var(--d)/5)"
|
||||||
|
>
|
||||||
|
X
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<h2>Now for BrickData taking parametrized template name</h2>
|
<h2>Now for BrickData taking parametrized template name</h2>
|
||||||
{{ define "brick" }}
|
{{ define "brick" }}
|
||||||
|
@ -37,6 +45,8 @@
|
||||||
{{ template "speakerBrick" .ColorClass }}
|
{{ template "speakerBrick" .ColorClass }}
|
||||||
{{ else if eq .TemplateType "markBrick" }}
|
{{ else if eq .TemplateType "markBrick" }}
|
||||||
{{ template "markBrick" .ColorClass }}
|
{{ template "markBrick" .ColorClass }}
|
||||||
|
{{ else if eq .TemplateType "markAndRaisedBrick" }}
|
||||||
|
{{ template "markAndRaisedBrick" .ColorClass }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
{{define "main-content"}}
|
{{define "main-content"}}
|
||||||
<div style="--d: 10rem">
|
<div style="--d: 10rem;">
|
||||||
|
|
||||||
<h2>For each type</h2>
|
<h2>For each type</h2>
|
||||||
<section class="grid grid-cols-5 border-4 gap-4">
|
<section class="grid grid-cols-6 border-4 gap-4">
|
||||||
<p>types:</p>
|
<p>types:</p>
|
||||||
<p> inactive </p>
|
<p> inactive </p>
|
||||||
<p> raised </p>
|
<p> raised </p>
|
||||||
<p> speaker </p>
|
<p> speaker </p>
|
||||||
<p> mark </p>
|
<p> mark </p>
|
||||||
|
<p> mark and active </p>
|
||||||
{{ range .Bricks }}
|
{{ range .Bricks }}
|
||||||
<div class="border-2">for {{ .Name }}</div>
|
<div class="border-2">for {{ .Name }}</div>
|
||||||
<div>{{ template "inactiveBrick" .ColorClass }}</div>
|
<div>{{ template "inactiveBrick" .ColorClass }}</div>
|
||||||
<div>{{ template "raisedBrick" .ColorClass }}</div>
|
<div>{{ template "raisedBrick" .ColorClass }}</div>
|
||||||
<div>{{ template "speakerBrick" .ColorClass }}</div>
|
<div>{{ template "speakerBrick" .ColorClass }}</div>
|
||||||
<div>{{ template "markBrick" .ColorClass }}</div>
|
<div>{{ template "markBrick" .ColorClass }}</div>
|
||||||
|
<div>{{ template "markAndRaisedBrick" .ColorClass }}</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue