diff --git a/includes/AnnotationHandler.php b/includes/AnnotationHandler.php index 165b3c4..7a595c7 100644 --- a/includes/AnnotationHandler.php +++ b/includes/AnnotationHandler.php @@ -131,33 +131,6 @@ class AnnotationHandler extends CodeContentHandler { $useCompass = ''; if (isset($metadata['view'])) { $viewLabels = self::getCompassLabels($metadata['view']['direction'], $metadata['view']['rostral']); - /* - $attrCompass = array( - 'id' => "compass{$svgID}", - 'viewBox' => '0 0 100 100', - 'preserveAspectRatio' => 'xMinYMin meet', - 'refX' => 'left', - 'refY' => 'top', - 'style' => "font-family:'TeX Gyre DejaVu Math';font-size:11.686px;letter-spacing:0px;line-height:125%;text-align:center;text-anchor:middle;word-spacing:0px;" - ); - $compass = array( - Html::openElement('symbol',$attrCompass) - ); - $attrCompBack = array( - 'cx' => '50', - 'cy' => '50', - 'r' => '50', - 'style' => 'fill-opacity:.35;fill:#ffffff;' - ); - array_push($compass,Html::rawElement('circle',$attrCompBack)); - $attrCompBkArrow = array( - 'd' => 'M 50,81.3 41.4,58.6 18.7,50 41.4,41.4 50,18.7 58.6,41.4 81.3,50 58.6,58.6 Z', - 'style' => 'fill:#ffffff;stroke-width:1.5025' - ); - array_push($compass, Html::rawElement('path',$attrCompBkArrow)); - - array_push($compass,Html::closeElement('symbol')); - */ $rotate = $metadata['view']['rotate'] ?? 0; $textRotate = $rotate * -1; $elCompass = << $annot) { @@ -249,7 +223,26 @@ class AnnotationHandler extends CodeContentHandler { $svgDefs = Html::rawElement('defs',array(),$markMask); } - return Html::rawElement('svg', $attrSvg, $svgDefs. $elCompass . $elBaseImg . implode($annotations) . $useCompass ); + $paths = []; + if (isset($metadata['path'])) { + array_push($paths, Html::openElement('g',array('transform' => "scale( {$fixScale} )"))); + foreach($metadata['path'] as $drawPath) { + if (isset($drawPath['d'])) { + $pathColor = $drawPath['color'] ?? '#ff0000'; + $pathPattern = $drawPath['pattern'] ?? '2 1'; + $attrPath = array( + 'd' => $drawPath['d'], + 'fill' => 'none', + 'stroke-dasharray' => $pathPattern, + 'style' => "fill-opacity:.35;stroke-linejoin:bevel;stroke-width:.4;stroke:{$pathColor}" + ); + array_push($paths,Html::rawElement('path',$attrPath)); + } + } + array_push($paths,Html::closeElement('g')); + } + + return Html::rawElement('svg', $attrSvg, $svgDefs. $elCompass . $elBaseImg . implode($annotations). implode($paths) . $useCompass ); } public function validateSave( Content $content, ValidationParams $validationParams ) {