Search code examples
autodesk-forgeautodesk-viewerforgeautodesk-model-derivative

Forge Viewer - after creating a new markup in viewer, can I select a dropdown value based on event "EVENT_MARKUP_SELECTED"?


enter image description here

function onDocumentLoadSuccess(viewerDocument) {
    var defaultModel = viewerDocument.getRoot().getDefaultGeometry();
    viewer.loadDocumentNode(viewerDocument, defaultModel)
    .then(function () {
        viewer.loadExtension('Autodesk.Viewing.MarkupsCore').then(function(markupsExt){
            markup = markupsExt;
            markup.enterEditMode();
            var cloud = new Autodesk.Viewing.Extensions.Markups.Core.EditModeCloud(markup);
            markup.changeEditMode(cloud);
            markup.addEventListener(Autodesk.Viewing.Extensions.Markups.Core.EVENT_MARKUP_SELECTED,selEvt)
        });
        
        
    })
    .catch(function (err) {
        //reject('Could not load viewable: ' + err);
    });
}
function selEvt(){
    jQuery('#sel').show();
}
  <div id="canvas-align">
  
        <div id="forgeViewer">
        </div>

    <div id="overlay">

      <div id="sel">
          <select>
            <option>Select</option>
            <option>RFI-100</option>
            <option>RFI-101</option>
            <option>RFI-102</option>
            <option>RFI-103</option>
          </select>  
      </div>

    </div>

</div>
</body>

Forge Viewer - after creating a new markup in viewer, can I select a dropdown value based on event "EVENT_MARKUP_SELECTED"? I tried it using below code but am I unable to select dropdown value. So then I tried to leave editmode, then it clears markup. Please advise


Solution

  • It seems that your dropdown list has been overlapped by the markup canvas. To fix it, please try to add these styles to the #sel

    #sel {
      position: absolute;
      z-index: 1;
      display: none;
    }
    

    Here is its look at my end: enter image description here