Add stand alone path capabilities
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -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 = <<<comp
|
||||
@@ -191,8 +164,9 @@ class AnnotationHandler extends CodeContentHandler {
|
||||
$useCompass = Html::rawElement('use', $attrCompass);
|
||||
}
|
||||
|
||||
if (isset($metadata['annotation'])) {
|
||||
$annotations = [];
|
||||
$svgDefs = '';
|
||||
if (isset($metadata['annotation'])) {
|
||||
$maskCircles = [];
|
||||
$leadLines = [];
|
||||
foreach($metadata['annotation'] as $label => $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 ) {
|
||||
|
||||
Reference in New Issue
Block a user