diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index e3ea26ecb9f..076f149d75c 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -13,6 +13,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Added ### Changed +- When creating or uploading a non-task volume annotation layer with a fallback segmentation layer, the annotation layer’s bounding box will now be limited to that layer’s, instead of the whole dataset’s. [#7580](https://github.com/scalableminds/webknossos/pull/7580) ### Fixed diff --git a/app/controllers/AnnotationIOController.scala b/app/controllers/AnnotationIOController.scala index 51ad028d6e3..9d29dfbc1a5 100755 --- a/app/controllers/AnnotationIOController.scala +++ b/app/controllers/AnnotationIOController.scala @@ -290,7 +290,8 @@ class AnnotationIOController @Inject()( case _ => None }.headOption val bbox = - if (volumeTracing.boundingBox.isEmpty) boundingBoxToProto(dataSource.boundingBox) + if (volumeTracing.boundingBox.isEmpty) + boundingBoxToProto(fallbackLayerOpt.map(_.boundingBox).getOrElse(dataSource.boundingBox)) else volumeTracing.boundingBox val elementClass = fallbackLayerOpt .map(layer => elementClassToProto(layer.elementClass)) diff --git a/app/models/annotation/AnnotationService.scala b/app/models/annotation/AnnotationService.scala index c4cdafb56e1..76fbfd69384 100755 --- a/app/models/annotation/AnnotationService.scala +++ b/app/models/annotation/AnnotationService.scala @@ -152,7 +152,7 @@ class AnnotationService @Inject()( } yield VolumeTracing( None, - boundingBoxToProto(boundingBox.getOrElse(dataSource.boundingBox)), + boundingBoxToProto(boundingBox.orElse(fallbackLayer.map(_.boundingBox)).getOrElse(dataSource.boundingBox)), System.currentTimeMillis(), dataSource.id.name, vec3IntToProto(startPosition.getOrElse(dataSource.center)),