Add annotation set functionality
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
@@ -65,22 +65,35 @@ class GlModelViewer extends ImageHandler {
|
|||||||
if (isset($frameParams['class'])) {
|
if (isset($frameParams['class'])) {
|
||||||
preg_match('/view-(\S*)/',$frameParams['class'],$viewClassExtract);
|
preg_match('/view-(\S*)/',$frameParams['class'],$viewClassExtract);
|
||||||
$viewClass = ($viewClassExtract[1]) ? $viewClassExtract[1] : 'default';
|
$viewClass = ($viewClassExtract[1]) ? $viewClassExtract[1] : 'default';
|
||||||
|
preg_match('/hsset-(\S*)/',$frameParams['class'],$hsSetClassExtract);
|
||||||
|
$hsSetClass = ($hsSetClassExtract[1]) ? $hsSetClassExtract[1] : 'default';
|
||||||
} else {
|
} else {
|
||||||
$viewClass = 'default';
|
$viewClass = 'default';
|
||||||
|
$hsSetClass = 'default';
|
||||||
}
|
}
|
||||||
if (isset($metadata['annotations'])) {
|
if (isset($metadata['annotations'])) {
|
||||||
$hotspots = [];
|
$hotspots = [];
|
||||||
foreach($metadata['annotations'] as $idx => $an) {
|
$annotations = [];
|
||||||
$elAnnot = Html::rawElement('div',['class' => 'HotspotAnnotation HiddenAnnotation'],$an['label']);
|
if ($hsSetClass != 'default' && isset($metadata['annotationSets'])) {
|
||||||
|
foreach($metadata['annotationSets'][$hsSetClass] as $includeAn) {
|
||||||
|
if (isset($metadata['annotations'][$includeAn])) {
|
||||||
|
$annotations[$includeAn] = $metadata['annotations'][$includeAn];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$annotations = $metadata['annotations'];
|
||||||
|
}
|
||||||
|
foreach($annotations as $label => $an) {
|
||||||
|
$elAnnot = Html::rawElement('div',['class' => 'HotspotAnnotation HiddenAnnotation'],$label);
|
||||||
$hsDefault = array(
|
$hsDefault = array(
|
||||||
'class' => 'Hotspot',
|
'class' => 'Hotspot',
|
||||||
'slot' => 'hotspot-'.($idx +1),
|
'slot' => 'hotspot-'.(count($hotspots) +1),
|
||||||
'onmousedown' => 'event.stopPropagation()',
|
'onmousedown' => 'event.stopPropagation()',
|
||||||
'ontouchstart' => 'event.stopPropagation()',
|
'ontouchstart' => 'event.stopPropagation()',
|
||||||
'onclick' => 'onAnnotation(event)'
|
'onclick' => 'onAnnotation(event)'
|
||||||
);
|
);
|
||||||
$attrHotspot = array_merge($hsDefault, $an);
|
$attrHotspot = array_merge($hsDefault, $an);
|
||||||
$elHotspot = Html::rawElement('button',$attrHotspot,$elAnnot.($idx +1));
|
$elHotspot = Html::rawElement('button',$attrHotspot,$elAnnot.(count($hotspots) +1));
|
||||||
array_push($hotspots, $elHotspot);
|
array_push($hotspots, $elHotspot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user