fix: mark & active brick type
This commit is contained in:
@@ -39,7 +39,7 @@ type roomTableData struct {
|
||||
currentPerson rooms.PersonId
|
||||
}
|
||||
|
||||
func (room *roomTableData)Persons() []personData {
|
||||
func (room *roomTableData) Persons() []personData {
|
||||
total := room.Total()
|
||||
persons := make([]personData, 0, total)
|
||||
currentPersonIndex := slices.Index(room.Paricipants, room.currentPerson)
|
||||
@@ -51,10 +51,10 @@ func (room *roomTableData)Persons() []personData {
|
||||
}
|
||||
return persons
|
||||
}
|
||||
func (r *roomTableData)Total() int {
|
||||
func (r *roomTableData) Total() int {
|
||||
return len(r.Paricipants)
|
||||
}
|
||||
func (r *roomTableData)Tangens() float64 {
|
||||
func (r *roomTableData) Tangens() float64 {
|
||||
total := r.Total()
|
||||
if total == 2 {
|
||||
return 1
|
||||
@@ -63,18 +63,18 @@ func (r *roomTableData)Tangens() float64 {
|
||||
}
|
||||
|
||||
type arrowData struct {
|
||||
IsVisible bool
|
||||
Height, Width int
|
||||
Radius int
|
||||
StartX, StartY int
|
||||
EndX, EndY int
|
||||
LargeArcFlag int
|
||||
IsVisible bool
|
||||
Height, Width int
|
||||
Radius int
|
||||
StartX, StartY int
|
||||
EndX, EndY int
|
||||
LargeArcFlag int
|
||||
Angle1X, Angle1Y int
|
||||
Angle2X, Angle2Y int
|
||||
}
|
||||
|
||||
// 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
|
||||
// and this is somewhat a win
|
||||
height, width := 150.0, 150.0
|
||||
@@ -92,8 +92,8 @@ func (r *roomTableData)ArrowData() arrowData {
|
||||
endSector += total
|
||||
}
|
||||
radius := 50.0
|
||||
startAngle := 90 + float64(startSector) * ( 360.0 / float64(total) )
|
||||
endAngle := 90 + float64(endSector) * ( 360.0 / float64(total) )
|
||||
startAngle := 90 + float64(startSector)*(360.0/float64(total))
|
||||
endAngle := 90 + float64(endSector)*(360.0/float64(total))
|
||||
// if need to draw full circle
|
||||
if startSector == endSector {
|
||||
startAngle += 3 // a bit forward
|
||||
@@ -103,42 +103,42 @@ func (r *roomTableData)ArrowData() arrowData {
|
||||
endAngleRad := endAngle * (math.Pi / float64(180))
|
||||
// endAngle is radius angle, so perpendicular gives direction of teh arrow
|
||||
|
||||
x1 := centerX + radius * math.Cos(startAngleRad)
|
||||
y1 := centerY + radius * math.Sin(startAngleRad)
|
||||
x2 := centerX + radius * math.Cos(endAngleRad)
|
||||
y2 := centerY + radius * math.Sin(endAngleRad)
|
||||
x1 := centerX + radius*math.Cos(startAngleRad)
|
||||
y1 := centerY + radius*math.Sin(startAngleRad)
|
||||
x2 := centerX + radius*math.Cos(endAngleRad)
|
||||
y2 := centerY + radius*math.Sin(endAngleRad)
|
||||
|
||||
arrowAngleOffset := math.Pi / 4 // 45 degrees
|
||||
arrowPointDirection := endAngleRad - math.Pi / 2
|
||||
arrowPointDirection := endAngleRad - math.Pi/2
|
||||
arrowheadLen := 10.0
|
||||
arrowMinusAngle := arrowPointDirection - arrowAngleOffset
|
||||
arrowPlusAngle := arrowPointDirection + arrowAngleOffset
|
||||
arrowMinusEndX := x2 + arrowheadLen * math.Cos(arrowMinusAngle)
|
||||
arrowMinusEndY := y2 + arrowheadLen * math.Sin(arrowMinusAngle)
|
||||
arrowPlusEndX := x2 + arrowheadLen * math.Cos(arrowPlusAngle)
|
||||
arrowPlusEndY := y2 + arrowheadLen * math.Sin(arrowPlusAngle)
|
||||
arrowMinusEndX := x2 + arrowheadLen*math.Cos(arrowMinusAngle)
|
||||
arrowMinusEndY := y2 + arrowheadLen*math.Sin(arrowMinusAngle)
|
||||
arrowPlusEndX := x2 + arrowheadLen*math.Cos(arrowPlusAngle)
|
||||
arrowPlusEndY := y2 + arrowheadLen*math.Sin(arrowPlusAngle)
|
||||
|
||||
// indicates that the shorter of the two possible arcs should be used.
|
||||
largeArcFlag := 0
|
||||
//
|
||||
if endAngleRad - startAngleRad > (math.Pi) {
|
||||
if endAngleRad-startAngleRad > (math.Pi) {
|
||||
// specifies that the longer arc should be chosen.
|
||||
largeArcFlag = 1
|
||||
}
|
||||
return arrowData{
|
||||
IsVisible: true,
|
||||
Height: int(height),
|
||||
Width: int(width),
|
||||
Radius: int(radius),
|
||||
StartX: int(x1),
|
||||
StartY: int(y1),
|
||||
EndX: int(x2),
|
||||
EndY: int(y2),
|
||||
IsVisible: true,
|
||||
Height: int(height),
|
||||
Width: int(width),
|
||||
Radius: int(radius),
|
||||
StartX: int(x1),
|
||||
StartY: int(y1),
|
||||
EndX: int(x2),
|
||||
EndY: int(y2),
|
||||
LargeArcFlag: largeArcFlag,
|
||||
Angle1X: int(arrowMinusEndX),
|
||||
Angle1Y: int(arrowMinusEndY),
|
||||
Angle2X: int(arrowPlusEndX),
|
||||
Angle2Y: int(arrowPlusEndY),
|
||||
Angle1X: int(arrowMinusEndX),
|
||||
Angle1Y: int(arrowMinusEndY),
|
||||
Angle2X: int(arrowPlusEndX),
|
||||
Angle2Y: int(arrowPlusEndY),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
for gesture := rooms.ChangeTopic; gesture <= rooms.Meta; gesture++ {
|
||||
// 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
|
||||
templateType := "inactiveBrick"
|
||||
switch {
|
||||
case pData.IsRaised && pData.IsMark && gesture == pData.Raised:
|
||||
templateType = "markAndRaisedBrick"
|
||||
case pData.IsMark && gesture == pData.Mark:
|
||||
templateType = "markBrick"
|
||||
case pData.IsSpeaker && gesture == pData.Raised:
|
||||
@@ -225,6 +227,10 @@ func roomTemplatesPreview(
|
||||
Id: rooms.PersonId(300),
|
||||
Name: "test person name 3",
|
||||
}
|
||||
var person4 = rooms.Person{
|
||||
Id: rooms.PersonId(400),
|
||||
Name: "test person name 4",
|
||||
}
|
||||
aRoom := rooms.Room{
|
||||
Name: "test",
|
||||
CurrentSpeaker: person3.Id,
|
||||
@@ -232,18 +238,22 @@ func roomTemplatesPreview(
|
||||
person1.Id: person1,
|
||||
person2.Id: person2,
|
||||
person3.Id: person3,
|
||||
person4.Id: person4,
|
||||
},
|
||||
Paricipants: []rooms.PersonId{
|
||||
person1.Id,
|
||||
person2.Id,
|
||||
person3.Id,
|
||||
person4.Id,
|
||||
},
|
||||
ParticipantHands: map[rooms.PersonId]rooms.HandGesture{
|
||||
person3.Id: rooms.ClarifyingQ,
|
||||
person2.Id: rooms.Meta,
|
||||
person4.Id: rooms.ChangeTopic,
|
||||
},
|
||||
Marks: map[rooms.HandGesture]rooms.PersonId{
|
||||
rooms.Expand: person1.Id,
|
||||
rooms.Expand: person1.Id,
|
||||
rooms.ChangeTopic: person4.Id,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -282,8 +292,8 @@ func roomTemplatesPreview(
|
||||
},
|
||||
},
|
||||
TestPerson: testPersonData,
|
||||
ARoom: &roomTableData{
|
||||
Room: &aRoom,
|
||||
ARoom: &roomTableData{
|
||||
Room: &aRoom,
|
||||
currentPerson: aRoom.Paricipants[0],
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user