protected override void OnPointerReleased(PointerReleasedEventArgs e) { if (_isDrawing || _isSelecting) { PointerPoint pp = e.GetCurrentPoint(this); switch (pp.Properties.PointerUpdateKind) { case PointerUpdateKind.LeftButtonReleased: { _isDrawing = false; e.Handled = true; break; } case PointerUpdateKind.RightButtonReleased: { _isSelecting = false; int startX = _selection.X; int startY = _selection.Y; int width = _selection.Width; int height = _selection.Height; bool changed = false; for (int y = 0; y < Overworld.Block_NumTilesY; y++) { Blockset.Block.Tile[] arrY = Clipboard[y]; for (int x = 0; x < Overworld.Block_NumTilesX; x++) { Blockset.Block.Tile t = arrY[x]; if (x < width && y < height) { Blockset.Block.Tile got = SubLayerModel.GetTile(_block, _eLayerNum, _subLayerNum, startX + x, startY + y); if (got != null) { if (!got.Equals(t)) { changed = true; got.CopyTo(t); } continue; } } if (t.TilesetTile != null) { changed = true; } t.TilesetTile = null; } } if (changed) { ClipboardChanged?.Invoke(this, EventArgs.Empty); } InvalidateVisual(); e.Handled = true; break; } } } }
internal unsafe void UpdateBitmap() { SubLayerModel.UpdateBitmap(_bitmap, _block, _eLayerNum, _subLayerNum); InvalidateVisual(); }