public override ToolState StartPointerSequence(PointerEventInfo info, ILevelGeometry viewport) { Tool._selectionManager.ClearSelection(); Tool.UpdatePropertyProvider(); return(this); }
protected override void PointerPositionCore(PointerEventInfo info, ILevelGeometry viewport) { if (_snapManager == null) { _snapManager = new SnappingManager(GetSnappingSourceOrigin(), GetSnappingSourceBounds(), GridSize); } }
private void StartFillSequence(PointerEventInfo info) { if (!SourceValid) { return; } TileCoord location = TileLocation(info); if (!TileInRange(location)) { return; } if (SourceType == TileSourceType.Brush) { Layer.TileAdding += TileAddingHandler; Layer.TileRemoving += TileRemovingHandler; } _fillLayer = Layer; _sourceStack = new TileStack(); _sourceStack.Add(ActiveTile); _fillCommand = new TileReplace2DCommand(Layer); FloodFill(location.X, location.Y); if (SourceType == TileSourceType.Brush) { Layer.TileAdding -= TileAddingHandler; Layer.TileRemoving -= TileRemovingHandler; } History.Execute(_fillCommand); }
public override void HandlePointerPosition(PointerEventInfo info) { if (_form._tileController == null || _form._layer == null) { return; } TileCoord location = TileLocation(info); if (!TileInRange(location)) { return; } if (_form._tileController.SelectedTile != null) { if (_form._tileController.SelectedTile.Width != _form._layer.TileWidth || _form._tileController.SelectedTile.Height != _form._layer.TileHeight) { MessageBox.Show("Selected tile not compatible with brush tile dimensions.", "Incompatible Tile", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } _form._layer.ClearTile(location.X, location.Y); if (!_erase) { _form._layer.AddTile(location.X, location.Y, _form._tileController.SelectedTile); } } }
private void EndEraseAreaSequence(PointerEventInfo info, ILevelGeometry viewport) { Rectangle selection = _band.Selection; int xmin = Math.Max(Layer.TileOriginX, selection.Left); int ymin = Math.Max(Layer.TileOriginY, selection.Top); int xmax = Math.Min(Layer.TileOriginX + Layer.TilesWide, selection.Right); int ymax = Math.Min(Layer.TileOriginY + Layer.TilesHigh, selection.Bottom); TileReplace2DCommand command = new TileReplace2DCommand(Layer); for (int x = xmin; x < xmax; x++) { for (int y = ymin; y < ymax; y++) { command.QueueReplacement(new TileCoord(x, y), (TileStack)null); Layer[new TileCoord(x, y)] = null; } } History.Execute(command); _annots.Remove(_selection); _inAreaSequence = false; EndAutoScroll(info, viewport); }
private void StartSelectTilesSequence(PointerEventInfo info, ILevelGeometry viewport) { bool controlKey = Control.ModifierKeys.HasFlag(Keys.Control); bool shiftKey = Control.ModifierKeys.HasFlag(Keys.Shift); if (shiftKey) { StartDragAdd(info, viewport); return; } if (controlKey) { StartDragRemove(info, viewport); return; } TileCoord location = TileLocation(info); if (!_selectLayer.TileSelectionCoverageAt(location)) { StartDragNew(info, viewport); } else { StartMove(info, viewport); } }
private ToolState StartTimeoutSequence(PointerEventInfo info, ILevelGeometry viewport, ObjectInstance obj) { return(new SelectionTimeoutToolState(Tool) { HitObject = obj }.StartPointerSequence(info, viewport)); }
public void HandleUpdatePointerSequence(PointerEventInfo info) { if (_currentTool != null) { _currentTool.UpdatePointerSequence(info, LayerContext.Geometry); } }
public virtual void HandlePointerPosition(PointerEventInfo info) { if (_parent != null) { _parent.HandlePointerPosition(info); } }
public virtual void HandleUpdatePointerSequence(PointerEventInfo info) { if (_parent != null) { _parent.HandleUpdatePointerSequence(info); } }
public override ToolState StartPointerSequence(PointerEventInfo info, ILevelGeometry viewport) { InitialLocation = new Point((int)info.X, (int)info.Y); Timeout = DateTime.Now; return(this); }
private ToolState StartClickRemove(PointerEventInfo info, ILevelGeometry viewport, ObjectInstance obj) { Tool._selectionManager.RemoveObjectFromSelection(obj); Tool.StartAutoScroll(info, viewport); Tool.UpdatePropertyProvider(); return(new SelectionStandbyToolState(Tool).StartPointerSequence(info, viewport)); }
public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport) { if ((DateTime.Now - Timeout).TotalMilliseconds < _timeoutThreshold) { return new RotationStandbyToolState(Tool) { HitObject = HitObject } }
private void StartDragRemove(PointerEventInfo info, ILevelGeometry viewport) { if (!_selectLayer.HasSelection) { return; } StartDrag(info, viewport, MergeAction.Remove); }
protected override void EndPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport) { switch (info.Type) { case PointerEventType.Primary: EndSelectTilesSequence(info, viewport); break; } }
private void StartDrawPathSequence(PointerEventInfo info) { if (ActiveTile == null && _activeBrush == null) { return; } _drawCommand = new TileReplace2DCommand(Layer); }
private void UpdateDragCommon(PointerEventInfo info, ILevelGeometry viewport) { TileCoord location = TileLocation(info); _band.End = new Point(location.X, location.Y); Rectangle selection = _band.Selection; _selectionAnnot.Start = new Point(selection.Left * Layer.TileWidth, selection.Top * Layer.TileHeight); _selectionAnnot.End = new Point(selection.Right * Layer.TileWidth, selection.Bottom * Layer.TileHeight); }
protected override void EndPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport) { _state = _state.EndPointerSequence(info, viewport); /*switch (info.Type) { * case PointerEventType.Primary: * EndSelectObjectSequence(info, viewport); * break; * }*/ }
private void EndMove(PointerEventInfo info, ILevelGeometry viewport) { Command command = new MoveTileSelectionCommand(_selectLayer, _initialOffset, _selectLayer.TileSelectionOffset); History.Execute(command); _action = UpdateAction.None; EndAutoScroll(info, viewport); }
protected override void StartPointerSequenceCore(PointerEventInfo info, ILevelGeometry viewport) { switch (info.Type) { case PointerEventType.Primary: StartFillSequence(info); break; } UpdatePointerSequence(info, viewport); }
public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport) { ClearAnnot(); Tool._selectionManager.AddObjectsToSelection(Tool.ObjectsInArea(Band.Selection)); Tool.EndAutoScroll(info, viewport); Tool.UpdatePropertyProvider(); return(new ReleaseToolState(Tool).EndPointerSequence(info, viewport)); }
public override void HandleStartPointerSequence(PointerEventInfo info) { base.HandleStartPointerSequence(info); if (info.Type == PointerEventType.Secondary && _form._tilePool.SelectedTile != null) { Point position = _form._pointerController.UntranslatePosition(new Point((int)info.X, (int)info.Y)); _form._tileContextMenu.Show(_form._layerControl, position); } }
public override ToolState UpdatePointerSequence(PointerEventInfo info, ILevelGeometry viewport) { Band.End = new Point((int)info.X, (int)info.Y); Rectangle selection = Band.Selection; Annot.Start = new Point(selection.Left, selection.Top); Annot.End = new Point(selection.Right, selection.Bottom); Tool.UpdateAutoScroll(info, viewport); return(this); }
public void HandleEndPointerSequence(PointerEventInfo info) { if (_currentTool != null) { _currentTool.EndPointerSequence(info, LayerContext.Geometry); } if (_currentTool is ObjectDrawTool && _currentTool.IsCancelled) { SetCurrentTool(NewSelectTool()); } }
protected override void PointerPositionCore(PointerEventInfo info, ILevelGeometry viewport) { TileCoord location = TileLocation(info); if (!TileInRange(location) || _inAreaSequence) { HidePreviewMarker(); return; } ShowPreviewMarker(location); }
public void HandlePointerPosition(PointerEventInfo info) { if (_currentTool != null) { _currentTool.PointerPosition(info, LayerContext.Geometry); } if (Info != null) { Info.ActionUpdateCoordinates(info.X + ", " + info.Y); } }
private void EndDrawPathSequence(PointerEventInfo info) { if (ActiveTile == null && _activeBrush == null) { return; } if (!_drawCommand.IsEmpty) { History.Execute(_drawCommand); } }
public void HandlePointerPosition(PointerEventInfo info) { if (_currentTool != null) { _currentTool.PointerPosition(info, LayerContext.Geometry); } if (Info != null) { TileCoord coords = MouseToTileCoords(new Point((int)info.X, (int)info.Y)); Info.ActionUpdateCoordinates(coords.X + ", " + coords.Y); } }
private void EndSelectTilesSequence(PointerEventInfo info, ILevelGeometry viewport) { switch (_action) { case UpdateAction.Move: EndMove(info, viewport); break; case UpdateAction.Box: EndDrag(info, viewport); break; } }
public override ToolState EndPointerSequence(PointerEventInfo info, ILevelGeometry viewport) { if (Annot == null) { float radius = Tool.MaxBoundingDiagonal(HitObject) / 2 + 5; Annot = new CircleAnnot(HitObject.ImageBounds.Center, radius); Annot.Outline = Outline; Annot.OutlineGlow = OutlineGlow; Tool._annots.Add(Annot); } return(this); }