func (cfg Config) New(dom DOM, log Log, board *board.Board, canvasParentDivQuery string) *Canvas {
	canvasQuery := canvasParentDivQuery + ">canvas"
	parentDiv := dom.QuerySelector(canvasParentDivQuery)
	element := dom.QuerySelector(canvasQuery)
	contextElement := element.Call("getContext", "2d")
	c := Canvas{
		dom: dom,
		log: log,
		ctx: &jsContext{
			ctx: contextElement,
		},
		board: board,
		selection: selection{
			dom:   dom,
			tiles: make(map[tile.ID]tileSelection),
		},
		parentDiv: parentDiv,
		element:   element,
		draw: drawMetrics{
			tileLength: cfg.TileLength,
		},
		MainColor:  cfg.MainColor,
		DragColor:  cfg.DragColor,
		TileColor:  cfg.TileColor,
		ErrorColor: cfg.ErrorColor,
	}
	return &c
}
// New Creates a canvas from the config.
New Creates a canvas from the config.
// New Creates a canvas from the config .
func (cfg Config) New(dom DOM, log Log, board *board.Board, canvasParentDivQuery string) *Canvas {
	canvasQuery := canvasParentDivQuery + ">canvas"
	parentDiv := dom.QuerySelector(canvasParentDivQuery)
	element := dom.QuerySelector(canvasQuery)
	contextElement := element.Call("getContext", "2d")
	c := Canvas{
		dom: dom,
		log: log,
		ctx: &jsContext{
			ctx: contextElement,
		},
		board: board,
		selection: selection{
			dom:   dom,
			tiles: make(map[tile.ID]tileSelection),
		},
		parentDiv: parentDiv,
		element:   element,
		draw: drawMetrics{
			tileLength: cfg.TileLength,
		},
		MainColor:  cfg.MainColor,
		DragColor:  cfg.DragColor,
		TileColor:  cfg.TileColor,
		ErrorColor: cfg.ErrorColor,
	}
	return &c
}
func ( cfg Config ) New ( dom DOM , log Log , board * board . Board , canvasParentDivQuery string ) * Canvas { canvasQuery := canvasParentDivQuery + " " parentDiv := dom . QuerySelector ( canvasParentDivQuery ) element := dom . QuerySelector ( canvasQuery ) contextElement := element . Call ( " " , " " ) c := Canvas { dom : dom , log : log , ctx : & jsContext { ctx : contextElement , } , board : board , selection : selection { dom : dom , tiles : make ( map [ tile . ID ] tileSelection ) , } , parentDiv : parentDiv , element : element , draw : drawMetrics { tileLength : cfg . TileLength , } , MainColor : cfg . MainColor , DragColor : cfg . DragColor , TileColor : cfg . TileColor , ErrorColor : cfg . ErrorColor , } return & c }
New Creates a canvas from the config.
New Creates a canvas from the config .