public Board() { canvas = new HTMLCanvasElement(); canvas.Style.Position = Position.Absolute; canvas.Style.Top = "50%"; canvas.Style.Left = "50%"; canvas.Style.Transform = "translate(-50%, -50%)"; canvas.OnClick = (e) => { var x = e.PageX - canvas.OffsetLeft + 0.5 * canvas.Width; var y = e.PageY - canvas.OffsetTop + 0.5 * canvas.Height; Console.WriteLine($"X: {x}, Y: {y}"); if (y > V1 && y < V) { for (int col = 0; col < Game.COLUMNS; col++) { if (x > V1 + col * V && x < V + col * V) { ColumnSelected?.Invoke(col); } } } }; Root = canvas; imageController1 = new HTMLImageElement(); imageController1.OnLoad = (_) => loadedImageController1.SetResult(0); imageController1.Src = "mouse.png"; imageController2 = new HTMLImageElement(); imageController2.OnLoad = (_) => loadedImageController2.SetResult(0); imageController2.Src = "chip2.svg"; }
protected virtual void OnColumnSelected(ColumnEventArgs args) { ColumnSelected?.Invoke(this, args); }