public override void Scroll(float x, float y) { DocViewer s = Source as DocViewer; if (s.thisCont.IsScrollView == false) { return; } base.Scroll(x, y); }
public override void TouchUp(PointF p) { //Console.WriteLine("Drag"); DocViewer s = Source as DocViewer; if (s == null) { return; } base.TouchUp(p); }
public override void Drag(float x, float y) { //Console.WriteLine("Drag"); DocViewer s = Source as DocViewer; if (s == null) { return; } PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; base.Drag(x, y); }
public override void Tap(PointF p) { //Console.WriteLine("Tab"); DocViewer s = Source as DocViewer; if (s == null) { return; } PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.bt1, pt, ang)) { Console.WriteLine("bt1"); s.bt1_Click(p); } if (ptIn.setPtinRect(s.window, s.bt2, pt, ang)) { Console.WriteLine("bt2"); s.bt2_Click(p); } if (ptIn.setPtinRect(s.window, s.bt_close, pt, ang)) { Console.WriteLine("bt3"); s.bt_close_Click(p); } else { //s.pptViewerCon_Tap(p); } base.Tap(p); }
public override void TouchDown(PointF p) { //Console.WriteLine("touchDown"); DocViewer s = Source as DocViewer; if (s == null) { return; } PointIn ptIn = new PointIn(); PointF pt = s.thisCont.ObjectTouches.MoveCenter; double ang = s.thisAngle + s.thisCont.RotateFilter.Target; if (ptIn.setPtinRect(s.window, s.documentviewWord, pt, ang)) { isDocViewer = true; s.thisCont.IsScrollView = true; } else { s.thisCont.IsScrollView = false; } }
public void Item_TouchUp(PointF p) { //절대 좌표로 변경 PointF globalPt = new PointF(thisCont.ObjectTouches.MoveCenter.X, thisCont.ObjectTouches.MoveCenter.Y); if (IsSelecting == true) { IsSelecting = false; main.Children.Remove(fileBoxObject); if (fileBoxObject.fileType == "image") { ImageView imgView = new ImageView(); main.Children.Add(imgView); ElementProperties imgViewProp = new ElementProperties(); imgViewProp.ElementSupport.AddSupportForAll(); MTSmoothContainer imgViewCont = new MTSmoothContainer(imgView, main, imgViewProp); imgViewCont.SetPosition(globalPt.X, globalPt.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(imgViewCont); imgView.setInit(main, window, framework, imgViewCont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo); } else if (fileBoxObject.fileType == "ppt") { PptViewer pptViewer = new PptViewer(); main.Children.Add(pptViewer); ElementProperties pptViewerProp = new ElementProperties(); pptViewerProp.ElementSupport.AddSupportForAll(); MTSmoothContainer pptViewerCont = new MTSmoothContainer(pptViewer, main, pptViewerProp); pptViewerCont.SetPosition(globalPt.X, globalPt.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(pptViewerCont); pptViewer.setInit(main, window, framework, pptViewerCont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo); } else if (fileBoxObject.fileType == "video") { VideoControl videoCon = new VideoControl(); System.Windows.Shapes.Rectangle i = videoCon.SetVideo(fileBoxObject.objInfo.FilePath); ElementProperties vprop = new ElementProperties(); vprop.ElementSupport.AddSupportForAll(); MTSmoothContainer cont = new MTSmoothContainer(videoCon, main, vprop); cont.SetPosition(globalPt.X, globalPt.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(cont); main.Children.Add(videoCon); // // cont.MaxX = (int)(this.screen_width); // cont.MaxY = (int)(this.screen_height); // cont.MinX = (int)(this.screen_width / 10); // cont.MinY = (int)(this.screen_height / 10); } else if (fileBoxObject.fileType == "doc") { DocViewer dv = new DocViewer(); ElementProperties vprop = new ElementProperties(); vprop.ElementSupport.AddSupportForAll(); MTSmoothContainer cont = new MTSmoothContainer(dv, main, vprop); cont.SetPosition(globalPt.X, globalPt.Y, thisAngle + thisCont.RotateFilter.Target, 1.0); framework.RegisterElement(cont); dv.setInit(main, window, framework, cont, thisAngle + thisCont.RotateFilter.Target, fileBoxObject.objInfo); main.Children.Add(dv); // // cont.MaxX = (int)(this.screen_width); // cont.MaxY = (int)(this.screen_height); // cont.MinX = (int)(this.screen_width / 10); // cont.MinY = (int)(this.screen_height / 10); } } if (IsMoving == true) { IsMoving = false; } if (IsRotating == true) { IsRotating = false; firstAng = false; } }
/// <summary> /// Checks if the element has a scroll viewer. It it does, uses the scroll viewer /// to scroll the content by the number of pixels moved. /// X and Y are inverted so that the scroll works like the iPhone (i.e. the touched /// item sticks to your finger). Works better without scrollbars shown. /// </summary> /// <param name="x">Change in the horizontal object relative movement center in pixels</param> /// <param name="y">Change in the vertical object relative movement center in pixels</param> public virtual void Scroll(float x, float y) { if (Source is FileBox3) { FileBox3 s = Source as FileBox3; if (isListBox == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.itemListBox)) { ScrollViewer.SetCanContentScroll(s.itemListBox, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.itemListBox.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.itemListBox.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else if (Source is DocViewer) { DocViewer s = Source as DocViewer; if (isDocViewer == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.documentviewWord)) { ScrollViewer.SetCanContentScroll(s.documentviewWord, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.documentviewWord.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.documentviewWord.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else if (Source is ContactsBox) { ContactsBox s = Source as ContactsBox; if (isListBox == true) { // This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(s.ContactslistBox)) { ScrollViewer.SetCanContentScroll(s.ContactslistBox, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = s.ContactslistBox.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } s.ContactslistBox.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } } else {// This sets it so that we scroll by pixels rather than by lines if (ScrollViewer.GetCanContentScroll(Source)) { ScrollViewer.SetCanContentScroll(Source, false); } // Find the scrollviewer and scroll it if there is one ScrollViewer scroll = Source.FindChild <ScrollViewer>() as ScrollViewer; if (scroll != null) { scroll.ScrollToHorizontalOffset(scroll.HorizontalOffset + (x * -1)); scroll.ScrollToVerticalOffset(scroll.VerticalOffset + (y * -1)); } Source.RaiseEvent(new RoutedEventArgs(MTEvents.ScrollEvent, Source)); } }