<template>
  <div style="height: 85vh; overflow: hidden;"><canvas id="myCanvas"></canvas></div>
</template>
<script setup lang="ts">

import mapboxgl from "mapbox-gl";
import Mx  from "mxdraw"
import * as THREE from "three"
import {createMxCad}from"mxcad"
const props = defineProps(['cadSelectData']);
 onMounted(() => {

  Mx.loadCoreCode().then(()=> {
    Mx.MxFun.createMxObject({
    canvasId: "myCanvas", // canvas元素的id
    cadFile: props.cadSelectData.url,
    useWebsocket: false,
    callback: (mxDrawObject, {
          canvas,
          canvasParent
      }) => {
          // 可以拿到canvas元素和它的父级元素
          //console.log(canvas, canvasParent)
          //console.log(mxDrawObject)
          // 图纸加载完成
          mxDrawObject.addEvent("loadComplete", () => {
            console.log("mx loadComplete");
          });
      }
 });

  })


 })

</script>
<style scoped lang="scss">

</style>
