Add right and bottom positioning of compass
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -133,8 +133,19 @@ class AnnotationHandler extends CodeContentHandler {
|
|||||||
$viewLabels = self::getCompassLabels($metadata['view']['direction'], $metadata['view']['rostral']);
|
$viewLabels = self::getCompassLabels($metadata['view']['direction'], $metadata['view']['rostral']);
|
||||||
$rotate = $metadata['view']['rotate'] ?? 0;
|
$rotate = $metadata['view']['rotate'] ?? 0;
|
||||||
$textRotate = $rotate * -1;
|
$textRotate = $rotate * -1;
|
||||||
|
$compSize = $metadata['view']['size'] ?? 25;
|
||||||
|
if (isset($metadata['view']['right'])) {
|
||||||
|
$compX = ($baseWidth / $fixScale) - $metadata['view']['right'] - $compSize;
|
||||||
|
} else {
|
||||||
|
$compX = $metadata['view']['left'] ?? 1;
|
||||||
|
}
|
||||||
|
if (isset($metadata['view']['bottom'])) {
|
||||||
|
$compY = ($baseHeight / $fixScale) - $metadata['view']['bottom'] - $compSize;
|
||||||
|
} else {
|
||||||
|
$compY = $metadata['view']['top'] ?? 1;
|
||||||
|
}
|
||||||
$elCompass = <<<comp
|
$elCompass = <<<comp
|
||||||
<symbol 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">
|
<symbol id="compass$svgID" viewBox="0 0 100 100" preserveAspectRatio="xMinYMin meet" 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">
|
||||||
<circle cx="50" cy="50" r="50" style="fill-opacity:.35;fill:#ffffff;"></circle>
|
<circle cx="50" cy="50" r="50" style="fill-opacity:.35;fill:#ffffff;"></circle>
|
||||||
<path 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:#000000;stroke-width:1.5;stroke:#000000"></path>
|
<path 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:#000000;stroke-width:1.5;stroke:#000000"></path>
|
||||||
<path d="m50 81.3 -8.6 -22.6 0 -8.6 -22.6 0 22.6 -8.6 8.6 0 0 -22.6 8.6 22.6 0 8.6 22.6 0 -22.6 8.6 -8.6 0z" style="fill:#ffffff;stroke-width:1.5025"></path>
|
<path d="m50 81.3 -8.6 -22.6 0 -8.6 -22.6 0 22.6 -8.6 8.6 0 0 -22.6 8.6 22.6 0 8.6 22.6 0 -22.6 8.6 -8.6 0z" style="fill:#ffffff;stroke-width:1.5025"></path>
|
||||||
@@ -147,18 +158,15 @@ class AnnotationHandler extends CodeContentHandler {
|
|||||||
</symbol>
|
</symbol>
|
||||||
comp;
|
comp;
|
||||||
|
|
||||||
//TODO: Right and Bottom and/or negative positioning
|
$compRotX = $compX + ($compSize * .5);
|
||||||
$compLeft = $metadata['view']['left'] ?? 0;
|
$compRotY = $compY + ($compSize * .5);
|
||||||
$compTop = $metadata['view']['top'] ?? 0;
|
|
||||||
$compRotX = $compLeft + (($metadata['view']['size'] ?? 25) * .5);
|
|
||||||
$compRotY = $compTop + (($metadata['view']['size'] ?? 25) * .5);
|
|
||||||
$attrCompass = array(
|
$attrCompass = array(
|
||||||
'href'=> "#compass" . $svgID,
|
'href'=> "#compass" . $svgID,
|
||||||
'transform' => "scale( $fixScale ) rotate( $rotate $compRotX $compRotY)",
|
'transform' => "scale( $fixScale ) rotate( $rotate $compRotX $compRotY)",
|
||||||
'x' => $compLeft,
|
'x' => $compX,
|
||||||
'y' => $compTop,
|
'y' => $compY,
|
||||||
'width' => $metadata['view']['size'] ?? 25,
|
'width' => $compSize,
|
||||||
'height' => $metadata['view']['size'] ?? 25,
|
'height' => $compSize,
|
||||||
'style' => "transform-box: fill-box;"
|
'style' => "transform-box: fill-box;"
|
||||||
);
|
);
|
||||||
$useCompass = Html::rawElement('use', $attrCompass);
|
$useCompass = Html::rawElement('use', $attrCompass);
|
||||||
|
|||||||
Reference in New Issue
Block a user