Skip to content

vc-drawings 绘图后 如何选中和鼠标悬停改变颜色 #539

Answered by zouyaoji
hanzhichao110 asked this question in Q&A
Discussion options

You must be logged in to vote

有个2思路
1、直接改。监听 vc-drawings 组件的面的事件。vc-drawings的面实际上是用的vc-polygon绘制的,所以只需要在vc-drawings上绑定:polygon-drawing-opts="polygonDrawingOpts" ,并在polygonDrawingOpts配置polygonOpts的事件即可。

  polygonDrawingOpts: {
    polygonOpts: {
      onMouseover: e => {
        console.log(e)
        const index = e.cesiumOject._vcPolylineIndex
        drawingsRef.value.getDrawingActionInstances()[3].cmpRef.value.renderDatas.value[index].polygonOpts.appearance = {
          type: 'MaterialAppearance',
          options: {
            material: {
              fabric: {
                type: 'Color',
                uniforms: {
                  color: 'red' // 你的选中颜色
                }
              }
            },
  …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@hanzhichao110
Comment options

@hanzhichao110
Comment options

@zouyaoji
Comment options

@hanzhichao110
Comment options

Answer selected by hanzhichao110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants