public void viewPane_Released(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; if (GlobalNodeHandler.TabletSelected) { if (GlobalNodeHandler.adding && tickcnt - clickstartcount < 10) { if (GlobalNodeHandler.clickedNode == null && GlobalNodeHandler.clickedLabel == null) { if (GlobalNodeHandler.CreateNewNode(mousePos.X, mousePos.Y, true)) { CalcPoint CreatePoint; CreatePoint = new CalcPoint(mousePos.X - GlobalNodeHandler.clickedNode.width, mousePos.Y - GlobalNodeHandler.clickedNode.height); GlobalNodeHandler.ShowTextBox(CreatePoint, activetext); repaint(this, new EventArgs()); } } } if (dragging) { dragging = false; int x = mousePos.X; int y = mousePos.Y; if (selectedGroup.Count != 0) { diffPoints = new List <CalcPoint>(); } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.SetPosition(mousePos.X, mousePos.Y, true); GlobalNodeHandler.clickedNode.setHovered(false); GlobalNodeHandler.clickedNode = null; repaint(this, new EventArgs()); } } if (transformPoint.X != 0 || transformPoint.Y != 0) { transformPoint = new CalcPoint(); transformnode.SetScaled(true); transformnode.UpdatePivots(); transformnode.UpdateTransformRec(); transformnode.updateRepresentation(); repaint(this, new EventArgs()); transformnode = null; } if (dragView) { dragView = false; repaint(this, new EventArgs()); } } else if (GlobalNodeHandler.mouseSelected) { viewPane_MouseUp(mousObj); } }
private void ZOOMOUT_PointerPressed(object sender, PointerRoutedEventArgs e) { double delta = -200d; CalcPoint mousePos = new CalcPoint(Window.Current.CoreWindow.Bounds.Width / 2, Window.Current.CoreWindow.Bounds.Height / 2); GlobalNodeHandler.Zoom((mousePos), delta); repaint(this, new EventArgs()); }
public void ResetButtons() { RestButtonColors(); GlobalNodeHandler.ResetSelection(); if (GlobalNodeHandler.selectedButton != Button.NONE) { btnMngr.ButtonCLicked(GlobalNodeHandler.selectedButton); } }
public void thisKeyDownExec(KeyObject keypress) { if (!GlobalNodeHandler.typing) { int x = keypress.currentMousePos.X; int y = keypress.currentMousePos.Y; if (keypress.thisKey == Key.N) { /*if (GlobalNodeHandler.viewNode.GetLastChild() != null) * { * GlobalNodeHandler.CreateNewNode(GlobalNodeHandler.viewNode.GetLastChild().xpos + GlobalNodeHandler.viewNode.GetLastChild().width + 200, * GlobalNodeHandler.viewNode.GetLastChild().ypos, false); * } * else if (GlobalNodeHandler.viewNode.GetChildren().Count == 0) * { * GlobalNodeHandler.CreateNewNode(10, 1000 / 2, false); * //GlobalNodeHandler.ShowTextBox(new CalcPoint(10, 1000 / 2), activetextbox); * }*/ } if (keypress.thisKey == Key.I) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null) { GlobalNodeHandler.JumpInto(GlobalNodeHandler.clickedNode); repaint(this, new EventArgs()); } } if (keypress.thisKey == Key.O) { GlobalNodeHandler.JumpOut(); repaint(this, new EventArgs()); } if (keypress.thisKey == Key.C) { if (GlobalNodeHandler.clickedNode == null) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null) { GlobalNodeHandler.clickedNode.setSelected(true); } } else { if ((GlobalNodeHandler.rightNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null && GlobalNodeHandler.rightNode != GlobalNodeHandler.clickedNode) { GlobalNodeHandler.clickedNode.setSelected(false); GlobalNodeHandler.clickedNode.AddConnection(GlobalNodeHandler.rightNode); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(3, "ConnectNodes", GlobalNodeHandler.clickedNode, GlobalNodeHandler.rightNode)); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.setSelected(false); GlobalNodeHandler.clickedNode = null; } } } if (keypress.thisKey == Key.D) { if (GlobalNodeHandler.clickedNode == null) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null) { GlobalNodeHandler.clickedNode.setSelected(true); } } else { if ((GlobalNodeHandler.rightNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null && GlobalNodeHandler.rightNode != GlobalNodeHandler.clickedNode) { GlobalNodeHandler.clickedNode.setSelected(false); GlobalNodeHandler.clickedNode.DeleteConnection(GlobalNodeHandler.rightNode); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(4, "DeleteConnections", GlobalNodeHandler.clickedNode, GlobalNodeHandler.rightNode)); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.setSelected(false); GlobalNodeHandler.clickedNode = null; } } } if (keypress.thisKey == Key.A) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null) { MindNodeAction action = new MindNodeAction(3, "DeleteConnections"); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); foreach (MindNode m in GlobalNodeHandler.clickedNode.connNodes) { action.involvedNodes.Push(GlobalNodeHandler.clickedNode); action.involvedNodes.Push(m); } foreach (MindNode m in GlobalNodeHandler.clickedNode.backconnNodes) { action.involvedNodes.Push(m); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); } GlobalNodeHandler.actionLog.AddAction(action); GlobalNodeHandler.clickedNode.DeleteAllConnections(); } } if (keypress.thisKey == Key.K) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(x, y)) != null) { MindNodeAction action = new MindNodeAction(3, "DeleteConnections"); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); foreach (MindNode m in GlobalNodeHandler.clickedNode.connNodes) { action.involvedNodes.Push(GlobalNodeHandler.clickedNode); action.involvedNodes.Push(m); } foreach (MindNode m in GlobalNodeHandler.clickedNode.backconnNodes) { action.involvedNodes.Push(m); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); } GlobalNodeHandler.actionLog.AddAction(action); GlobalNodeHandler.clickedNode.DeleteAllConnections(); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(1, "DeleteNode", GlobalNodeHandler.clickedNode)); GlobalNodeHandler.viewNode.DeleteNode(GlobalNodeHandler.clickedNode); } } if (keypress.thisKey == Key.U) { GlobalNodeHandler.actionLog.UndoLast(); } if (keypress.thisKey == Key.R) { GlobalNodeHandler.actionLog.RedoLast(); } if (keypress.thisKey == Key.RIGHT) { arrowdir.X = 1; GlobalNodeHandler.viewNode.MoveView(arrowdir, 15); //panel1.HorizontalScroll.Value = panel1.HorizontalScroll.Value + 15; } if (keypress.thisKey == Key.LEFT) { arrowdir.X = -1; GlobalNodeHandler.viewNode.MoveView(arrowdir, 15); //if(panel1.HorizontalScroll.Value > 15) // panel1.HorizontalScroll.Value = panel1.HorizontalScroll.Value - 15; } if (keypress.thisKey == Key.UP) { arrowdir.Y = -1; GlobalNodeHandler.viewNode.MoveView(arrowdir, 15); //panel1.VerticalScroll.Value = panel1.HorizontalScroll.Value + 15; } if (keypress.thisKey == Key.DOWN) { arrowdir.Y = 1; GlobalNodeHandler.viewNode.MoveView(arrowdir, 15); //if (panel1.VerticalScroll.Value > 15) // panel1.VerticalScroll.Value = panel1.VerticalScroll.Value - 15; } repaint(this, new EventArgs()); } }
public async void viewPane_Pressed(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; if (GlobalNodeHandler.TabletSelected) { if (!GlobalNodeHandler.typing) { if (GlobalNodeHandler.pick1.BoxContains(mousePos.ToPoint())) { if (GlobalNodeHandler.pick1.ChangeColorTo(mousePos.ToPoint())) { repaint(this, new EventArgs()); } } else { if (GlobalNodeHandler.transforming) { if ((transformnode = GlobalNodeHandler.viewNode.ContainsTRecChild(mousePos.X, mousePos.Y)) != null) { MindNodeAction action = new MindNodeAction(6, "Transform", transformnode); transformStart = mousePos; startWidth = transformnode.width; startHeight = transformnode.height; action.sourceSize.X = startWidth; action.sourceSize.Y = startHeight; action.startpoint.Push(new CalcPoint(transformnode.xpos, transformnode.ypos)); dragView = false; NodeStart = new CalcPoint(transformnode.xpos, transformnode.ypos); if (mousePos.X < transformnode.xpos + transformInBorder) { transformPoint.X = -1; } else if (mousePos.X > transformnode.xpos + transformnode.width - transformInBorder) { transformPoint.X = 1; } if (mousePos.Y < transformnode.ypos + transformInBorder) { transformPoint.Y = -1; } else if (mousePos.Y > transformnode.ypos + transformnode.height - transformInBorder) { transformPoint.Y = 1; } GlobalNodeHandler.actionLog.AddAction(action); } } if (GlobalNodeHandler.connecting) { if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.setSelected(false); } } if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) == null) { GlobalNodeHandler.clickedLabel = GlobalNodeHandler.viewNode.ContainsChildLabel(mousePos.X, mousePos.Y); GlobalNodeHandler.rightNode = null; mouseStartPoint = mousePos; if (transformnode == null) { dragView = true; } clickstartcount = tickcnt; if (GlobalNodeHandler.coloring) { if (GlobalNodeHandler.clickedLabel != null) { GlobalNodeHandler.clickedLabel.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedLabel.updateRepresentation(); repaint(this, new EventArgs());; } } if (GlobalNodeHandler.paste) { await GlobalNodeHandler.settings.RestoreFromClipboard(mousePos.X, mousePos.Y); } } else { if (mousObj.thisButton.Equals(MouseButton.LEFT)) { if (GlobalNodeHandler.coloring) { if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.NodeColor = ColorPicker.selectedcolor; GlobalNodeHandler.clickedNode.updateRepresentation(); repaint(this, new EventArgs());; } } if (GlobalNodeHandler.jumping) { GlobalNodeHandler.JumpInto(GlobalNodeHandler.clickedNode); repaint(this, new EventArgs()); } if (GlobalNodeHandler.copy) { GlobalNodeHandler.settings.CopyToClipboard(GlobalNodeHandler.clickedNode); } else if (GlobalNodeHandler.cut) { GlobalNodeHandler.settings.CopyToClipboard(GlobalNodeHandler.clickedNode); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(1, "DeleteNode", GlobalNodeHandler.clickedNode)); GlobalNodeHandler.clickedNode.DeleteAllConnections(); GlobalNodeHandler.clickedNode.DeleteNode(); repaint(this, new EventArgs()); } else if (GlobalNodeHandler.connecting) { if (GlobalNodeHandler.rightNode == null) { GlobalNodeHandler.rightNode = GlobalNodeHandler.clickedNode; GlobalNodeHandler.rightNode.setSelected(true); } else if (!GlobalNodeHandler.clickedNode.Equals(GlobalNodeHandler.rightNode)) { GlobalNodeHandler.rightNode.setSelected(false); if (GlobalNodeHandler.rightNode.AddConnection(GlobalNodeHandler.clickedNode)) { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(3, "ConnectNodes", GlobalNodeHandler.rightNode, GlobalNodeHandler.clickedNode)); } GlobalNodeHandler.rightNode.UpdateBridgesRepresentation(); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } repaint(this, new EventArgs()); } else if (GlobalNodeHandler.disconnecting) { if (GlobalNodeHandler.rightNode == null) { GlobalNodeHandler.rightNode = GlobalNodeHandler.clickedNode; GlobalNodeHandler.rightNode.setSelected(true); } else { GlobalNodeHandler.rightNode.setSelected(false); if (GlobalNodeHandler.rightNode.connNodes.Contains(GlobalNodeHandler.clickedNode)) { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(4, "DeleteConnections", GlobalNodeHandler.rightNode, GlobalNodeHandler.clickedNode)); } else { GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(4, "DeleteConnections", GlobalNodeHandler.clickedNode, GlobalNodeHandler.rightNode)); } GlobalNodeHandler.rightNode.DeleteConnection(GlobalNodeHandler.clickedNode); GlobalNodeHandler.clickedNode.DeleteConnection(GlobalNodeHandler.rightNode); GlobalNodeHandler.clickedNode = null; GlobalNodeHandler.rightNode = null; } repaint(this, new EventArgs()); } else if (GlobalNodeHandler.deleting) { MindNodeAction action = new MindNodeAction(3, "DeleteConnections"); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); foreach (MindNode m in GlobalNodeHandler.clickedNode.connNodes) { action.involvedNodes.Push(GlobalNodeHandler.clickedNode); action.involvedNodes.Push(m); } foreach (MindNode m in GlobalNodeHandler.clickedNode.backconnNodes) { action.involvedNodes.Push(m); action.involvedNodes.Push(GlobalNodeHandler.clickedNode); } GlobalNodeHandler.actionLog.AddAction(action); GlobalNodeHandler.clickedNode.DeleteAllConnections(); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(1, "DeleteNode", GlobalNodeHandler.clickedNode)); GlobalNodeHandler.viewNode.DeleteNode(GlobalNodeHandler.clickedNode); repaint(this, new EventArgs()); } else if (GlobalNodeHandler.moving) { if (selectedGroup.Count != 0) { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes"); foreach (MindNode m in selectedGroup) { diffPoints.Add(new CalcPoint(m.xpos - GlobalNodeHandler.clickedNode.xpos, m.ypos - GlobalNodeHandler.clickedNode.ypos)); moveaction.startpoint.Push(new CalcPoint(m.xpos, m.ypos)); moveaction.involvedNodes.Push(m); } GlobalNodeHandler.actionLog.AddAction(moveaction); } else { MindNodeAction moveaction = new MindNodeAction(2, "MoveNodes", GlobalNodeHandler.clickedNode); moveaction.startpoint.Push(new CalcPoint(GlobalNodeHandler.clickedNode.xpos, GlobalNodeHandler.clickedNode.ypos)); GlobalNodeHandler.actionLog.AddAction(moveaction); } dragging = true; } } } if (GlobalNodeHandler.placelabel) { if (GlobalNodeHandler.clickedNode != null) { activetext.Text = GlobalNodeHandler.clickedNode.text; GlobalNodeHandler.ShowTextBox(mousObj.currentMousePos, activetext); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedNode, GlobalNodeHandler.clickedNode.text)); GlobalNodeHandler.typing = true; } else if (GlobalNodeHandler.clickedLabel != null) { activetext.Text = GlobalNodeHandler.clickedLabel.GetText(); GlobalNodeHandler.ShowTextBox(mousObj.currentMousePos, activetext); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedLabel, GlobalNodeHandler.clickedLabel.GetText())); GlobalNodeHandler.typing = true; } } } } } else if (GlobalNodeHandler.mouseSelected) { viewPane_MouseDown(mousObj); } }
public void viewPane_MouseUp(MouseObject mousObj) { CalcPoint mousePos = mousObj.currentMousePos; //MainPage.status2 += "Released"+"" + ptrPt.Properties.IsRightButtonPressed.ToString(); if (mousObj.thisButton.Equals(MouseButton.LEFT)) { if (tickcnt - clickstartcount < 10 && !surpressMouseup) { surpressMouseup = false; //System.out.println("mouseclick"); if (!GlobalNodeHandler.typing) { if ((GlobalNodeHandler.clickedNode = GlobalNodeHandler.viewNode.ContainsChildNode(mousePos.X, mousePos.Y)) == null) { if (!dragView) { if ((GlobalNodeHandler.clickedLabel = GlobalNodeHandler.viewNode.ContainsChildLabel(mousePos.X, mousePos.Y)) != null) { activetext.Visibility = Visibility.Visible; activetext.Margin = new Thickness(currentFormPosition.X, currentFormPosition.Y, 0, 0); activetext.Text = GlobalNodeHandler.clickedLabel.GetText(); GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedLabel, GlobalNodeHandler.clickedLabel.GetText())); GlobalNodeHandler.typing = true; } else { if (GlobalNodeHandler.CreateNewNode(mousePos.X, mousePos.Y, true)) { CalcPoint CreatePoint = new CalcPoint(); if (currentFormPosition != null) { CreatePoint = new CalcPoint(currentFormPosition.X - GlobalNodeHandler.clickedNode.width, currentFormPosition.Y - GlobalNodeHandler.clickedNode.height); } GlobalNodeHandler.ShowTextBox(CreatePoint, activetext); repaint(this, new EventArgs()); } } } } else { activetext.Visibility = Visibility.Visible; activetext.Margin = new Thickness(currentFormPosition.X, currentFormPosition.Y, 0, 0); activetext.Text = GlobalNodeHandler.clickedNode.text; GlobalNodeHandler.actionLog.AddAction(new MindNodeAction(5, "ChangeText", GlobalNodeHandler.clickedNode, GlobalNodeHandler.clickedNode.text)); GlobalNodeHandler.typing = true; } } if (dragRec) { mouseEndPoint = mousePos; dragRec = false; selectedGroup = GlobalNodeHandler.viewNode.ChildrenInRec(selectionRec); foreach (MindNode m in selectedGroup) { m.setHovered(true); } selectionRec = new Rect(0, 0, 0, 0); repaint(this, new EventArgs()); } else if (dragView) { dragView = false; repaint(this, new EventArgs()); } } } if (mousObj.thisButton.Equals(MouseButton.RIGHT)) { if (transformrecx != 0 || transformrecy != 0) { if (transformrecx != 0) { transformrecx = 0; } if (transformrecy != 0) { transformrecy = 0; } GlobalNodeHandler.clickedNode.SetScaled(true); GlobalNodeHandler.clickedNode.updateRepresentation(); repaint(this, new EventArgs()); } if (dragging) { dragging = false; int x = mousePos.X; int y = mousePos.Y; if (selectedGroup.Count != 0) { diffPoints = new List <CalcPoint>(); } else if (GlobalNodeHandler.clickedNode != null) { GlobalNodeHandler.clickedNode.SetPosition(x, y, true); GlobalNodeHandler.clickedNode.setHovered(false); GlobalNodeHandler.clickedNode = null; repaint(this, new EventArgs()); } } else if (dragView) { dragView = false; repaint(this, new EventArgs()); } } }
private void JumpOutof_PointerPressed(object sender, PointerRoutedEventArgs e) { GlobalNodeHandler.JumpOut(); repaint(this, new EventArgs()); }