private MouseEventArgs scaleMouseEvent(MouseEventArgs e) { int offset = 0;// (int)(SharedSettings.fScale); if (!ss.getActiveSelection()) { if (lv.getActiveLayer().isLayerVisible()) { return(new MouseEventArgs(e.Button, e.Clicks, (int)((e.X - offset) / ss.getDrawScale()), (int)((e.Y - offset) / ss.getDrawScale()), e.Delta)); } else { return(null); } } else if (Tools[iActiveTool] is MoveTool) { return(new MouseEventArgs(e.Button, e.Clicks, (int)(((e.X - ss.getSelectionPoint().X) - offset) / ss.getDrawScale()), (int)(((e.Y - ss.getSelectionPoint().Y) - offset) / ss.getDrawScale()), e.Delta)); } else { Rectangle rect = new Rectangle(ss.getSelectionPoint(), ss.getSelectionSize()); if ((ss.getActiveSelection() && rect.Contains(e.X, e.Y)) || Tools[iActiveTool] is SelectionTool) { return(new MouseEventArgs(e.Button, e.Clicks, (int)(((e.X - ss.getSelectionPoint().X) - offset) / ss.getDrawScale()), (int)(((e.Y - ss.getSelectionPoint().Y) - offset) / ss.getDrawScale()), e.Delta)); } else { return(null); } } return(null); }
public void GridDraw(Graphics g) { Pen p = new Pen(Color.Black); int yMod = ss.getCanvasHeight(); int xMod = ss.getCanvasWidth(); int width = ss.getGridWitdh(); int zoom = (int)ss.getDrawScale(); float factor = (ss.getDrawScale()); if (width > 0) { for (int y = 0; y < (int)(yMod * factor); y += (int)(width * factor)) { g.DrawLine(p, 0, y, (int)(yMod * factor), y); } for (int x = 0; x < (int)(xMod * factor); x += (int)(width * factor)) { g.DrawLine(p, x, 0, x, (int)(xMod * factor)); } } else if (width == -1) { if (zoom >= 15) { for (int y = 0; y < yMod; y += zoom) { g.DrawLine(p, 0, y, yMod, y); } for (int x = 0; x < xMod; x += zoom) { g.DrawLine(p, x, 0, x, xMod); } } else if (zoom < 15 && zoom > 10) { //TODO } } }