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'])) {
|
||||
preg_match('/view-(\S*)/',$frameParams['class'],$viewClassExtract);
|
||||
$viewClass = ($viewClassExtract[1]) ? $viewClassExtract[1] : 'default';
|
||||
preg_match('/hsset-(\S*)/',$frameParams['class'],$hsSetClassExtract);
|
||||
$hsSetClass = ($hsSetClassExtract[1]) ? $hsSetClassExtract[1] : 'default';
|
||||
} else {
|
||||
$viewClass = 'default';
|
||||
$hsSetClass = 'default';
|
||||
}
|
||||
if (isset($metadata['annotations'])) {
|
||||
$hotspots = [];
|
||||
foreach($metadata['annotations'] as $idx => $an) {
|
||||
$elAnnot = Html::rawElement('div',['class' => 'HotspotAnnotation HiddenAnnotation'],$an['label']);
|
||||
$annotations = [];
|
||||
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(
|
||||
'class' => 'Hotspot',
|
||||
'slot' => 'hotspot-'.($idx +1),
|
||||
'slot' => 'hotspot-'.(count($hotspots) +1),
|
||||
'onmousedown' => 'event.stopPropagation()',
|
||||
'ontouchstart' => 'event.stopPropagation()',
|
||||
'onclick' => 'onAnnotation(event)'
|
||||
);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user