0

我是 React konva 的完整初学者。我想做的很简单。我有两个重叠的图层,在按钮单击上我想销毁一个图层。我怎样才能提前实现这个Thnx

    
<input
    type="button"
    value="clear"
    onClick=???
></input>
<Stage
  width={width}
  height={height}
  onMouseDown={drag ? null : (e) => handleMouseDown(e)}

>
  <Layer> //////LAYER 1
    <Image width={width} height={height} image={image} />
    <Line
      points={[
        mainStateRef.current.scale_cords.x1,
        mainStateRef.current.scale_cords.y1,
        mainStateRef.current.scale_cords.x2,
        mainStateRef.current.scale_cords.y2,
      ]}
      stroke="red"
      strokeWidth={1}
      shadowBlur={0}
    />
  </Layer>
  <Layer> //////LAYER 2 Which I want to destroy
    {coords.map((cir, index) => (

          <Arrow
            points={[
              coords[index - 1][0],
              coords[index - 1][1],
              coords[index][0],
              coords[index][1],
            ]}
            stroke="#000"
            fill="#000"
            strokeWidth={1}
            pointerWidth={6}
          ></Arrow>
    ))}
  </Layer>
</Stage>;
4

0 回答 0