import Konva from "konva";

const container=function (width=0,height=0,container){
  const stage = new Konva.Stage({
    container: container,
    width: width,
    height: height,
  });

  const layer = new Konva.Layer();
  stage.add(layer)
  layer.draw();

  const imageObj = new Image();
  const imgSize=width
  imageObj.src = require('@/assets/kban/bg.png');
  imageObj.onload = function () {
    const shape = new Konva.Image({
      x: 0,
      y: 0,
      width: imgSize,
      height:this.height,
      image: imageObj,
    });
    layer.add(shape)
    shape.zIndex(0)
  }

  return {
    stage,layer
  }
}

export default container
