// Make sure that if we are editting a layer, the layer is always added to the Schets public override void ToolChange(SchetsControl s) { if(edittingLayer != null) { s.CommitAction(new SchetsActionAddLayer(edittingLayer)); edittingLayer = null; } }
public override void MuisLos(SchetsControl s, Point p) { Bezig(s, startpunt, p); if(edittingLayer != null) { s.CommitAction(new SchetsActionAddLayer(edittingLayer)); edittingLayer = null; } }
// Make sure that if we are editting a layer, the layer is always added to the Schets // and that its Editting property is set to false when changing tools public override void ToolChange(SchetsControl s) { if(edittingLayer != null) { ((LayerText)edittingLayer).Editting = false; s.CommitAction(new SchetsActionAddLayer(edittingLayer)); s.Invalidate(); } }
public override void MuisVast(SchetsControl s, Point p) { if(edittingLayer != null) { ((LayerText) edittingLayer).Editting = false; s.CommitAction(new SchetsActionAddLayer(edittingLayer)); s.Invalidate(); } base.MuisVast(s, p); }
// Commit the move action when the tool changes public virtual void ToolChange(SchetsControl s) { if(selectedLayer != null) { s.CommitAction(new SchetsActionMove(selectedLayer, selectedLayer.Location.X - oldLayerPos.X, selectedLayer.Location.Y - oldLayerPos.Y)); s.Invalidate(); selectedLayer = null; } }
/// <summary>Erases the layer at the given position (if there is one)</summary> /// <param name="s">The SchetsControl to erase the layer from</param> /// <param name="p">The position of the layer that should be erased</param> private void eraseLayer(SchetsControl s, Point p) { // Loop through the layers from top to bottom for(int i = s.Schets.Layers.Count; i != 0; --i) { // Check if we found a layer at the given position if(s.Schets.Layers[i-1].IsClicked(p)) { s.CommitAction(new SchetsActionRemoveLayer(s.Schets.Layers[i - 1], i - 1)); s.Schets.Layers.RemoveAt(i - 1); s.Invalidate(); return; } } }