Fix annotation order for pen drawings #12249

This commit is contained in:
hiroshisuga 2022-01-06 06:39:44 +09:00 committed by GitHub
parent 5743b29eba
commit 142f9e447a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,10 +152,7 @@ class WhiteboardModel extends SystemConfiguration {
val updatedAnnotationData = annotation.annotationInfo + ("points" -> pathData.points.asScala.toList) + ("commands" -> pathData.commands.asScala.toList)
//println("oldAnnotation value = " + oldAnnotationOption.getOrElse("Empty"))
var newPosition: Int = oldAnnotationOption match {
case Some(annotation) => annotation.position
case None => wb.annotationCount
}
var newPosition: Int = wb.annotationCount
val updatedAnnotation = annotation.copy(position = newPosition, annotationInfo = updatedAnnotationData)
@ -170,7 +167,7 @@ class WhiteboardModel extends SystemConfiguration {
val newAnnotationsMap = wb.annotationsMap + (userId -> (updatedAnnotation :: newUsersAnnotations))
//println("Annotation has position [" + usersAnnotations.head.position + "]")
val newWb = wb.copy(annotationsMap = newAnnotationsMap)
val newWb = wb.copy(annotationCount = wb.annotationCount + 1, annotationsMap = newAnnotationsMap)
//println("Updating annotation on page [" + wb.id + "]. After numAnnotations=[" + getAnnotationsByUserId(wb, userId).length + "].")
saveWhiteboard(newWb)