private void TransportDrag(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(Mask_Canvas); PntY_On = ptrPt.Position.Y; ItmY_On1 = Convert.ToDouble(Bus1_Canvas.GetValue(Canvas.TopProperty)); ItmY_On2 = Convert.ToDouble(Bus2_Canvas.GetValue(Canvas.TopProperty)); ItmY_On3 = Convert.ToDouble(Bus3_Canvas.GetValue(Canvas.TopProperty)); ItmY_On4 = Convert.ToDouble(Bus4_Canvas.GetValue(Canvas.TopProperty)); ItmY_On5 = Convert.ToDouble(Bus5_Canvas.GetValue(Canvas.TopProperty)); }
private void TransportMove(object sender, PointerRoutedEventArgs e) { Windows.UI.Input.PointerPoint ptrPt = e.GetCurrentPoint(Mask_Canvas); if (ptrPt.Properties.IsLeftButtonPressed) { deltaY = PntY_On - ptrPt.Position.Y; Bus1_Canvas.SetValue(Canvas.TopProperty, ItmY_On1 - deltaY); Bus2_Canvas.SetValue(Canvas.TopProperty, ItmY_On2 - deltaY); Bus3_Canvas.SetValue(Canvas.TopProperty, ItmY_On3 - deltaY); Bus4_Canvas.SetValue(Canvas.TopProperty, ItmY_On4 - deltaY); Bus5_Canvas.SetValue(Canvas.TopProperty, ItmY_On5 - deltaY); if (Convert.ToInt32(Bus1_Canvas.GetValue(Canvas.TopProperty)) > 0) { Bus1_scale.ScaleX = 1 - (Math.Abs(70 - Convert.ToDouble(Bus1_Canvas.GetValue(Canvas.TopProperty))) / 160); Bus1_scale.ScaleY = 1 - (Math.Abs(70 - Convert.ToDouble(Bus1_Canvas.GetValue(Canvas.TopProperty))) / 160); if (Bus1_scale.ScaleX < 0.63) { Bus1_scale.ScaleX = 0.63; } ; if (Bus1_scale.ScaleY < 0.63) { Bus1_scale.ScaleY = 0.63; } ; } if (Convert.ToInt32(Bus2_Canvas.GetValue(Canvas.TopProperty)) > 0) { Bus2_scale.ScaleX = 1 - (Math.Abs(70 - Convert.ToDouble(Bus2_Canvas.GetValue(Canvas.TopProperty))) / 160); Bus2_scale.ScaleY = 1 - (Math.Abs(70 - Convert.ToDouble(Bus2_Canvas.GetValue(Canvas.TopProperty))) / 160); if (Bus2_scale.ScaleX < 0.63) { Bus2_scale.ScaleX = 0.63; } ; if (Bus2_scale.ScaleY < 0.63) { Bus2_scale.ScaleY = 0.63; } ; } if (Convert.ToInt32(Bus3_Canvas.GetValue(Canvas.TopProperty)) > 0) { Bus3_scale.ScaleX = 1 - (Math.Abs(70 - Convert.ToDouble(Bus3_Canvas.GetValue(Canvas.TopProperty))) / 160); Bus3_scale.ScaleY = 1 - (Math.Abs(70 - Convert.ToDouble(Bus3_Canvas.GetValue(Canvas.TopProperty))) / 160); if (Bus3_scale.ScaleX < 0.63) { Bus3_scale.ScaleX = 0.63; } ; if (Bus3_scale.ScaleY < 0.63) { Bus3_scale.ScaleY = 0.63; } ; } if (Convert.ToInt32(Bus4_Canvas.GetValue(Canvas.TopProperty)) > 0) { Bus4_scale.ScaleX = 1 - (Math.Abs(70 - Convert.ToDouble(Bus4_Canvas.GetValue(Canvas.TopProperty))) / 160); Bus4_scale.ScaleY = 1 - (Math.Abs(70 - Convert.ToDouble(Bus4_Canvas.GetValue(Canvas.TopProperty))) / 160); if (Bus4_scale.ScaleX < 0.63) { Bus4_scale.ScaleX = 0.63; } ; if (Bus4_scale.ScaleY < 0.63) { Bus4_scale.ScaleY = 0.63; } ; } if (Convert.ToInt32(Bus5_Canvas.GetValue(Canvas.TopProperty)) > 0) { Bus5_scale.ScaleX = 1 - (Math.Abs(70 - Convert.ToDouble(Bus5_Canvas.GetValue(Canvas.TopProperty))) / 160); Bus5_scale.ScaleY = 1 - (Math.Abs(70 - Convert.ToDouble(Bus5_Canvas.GetValue(Canvas.TopProperty))) / 160); if (Bus5_scale.ScaleX < 0.63) { Bus5_scale.ScaleX = 0.63; } ; if (Bus5_scale.ScaleY < 0.63) { Bus5_scale.ScaleY = 0.63; } ; } } }