프로젝트

일반

사용자정보

개정판 2aaf9645

ID2aaf96454a8990bdeed1beafafa5255d150efe13
상위 a2488f05
하위 ec052e41

humkyung 이(가) 6년 이상 전에 추가함

fixed issue #543: Markup 이동 시 Highlight

차이점 보기:

KCOM/Controls/Sample.xaml.cs
606 606
            }
607 607
        }
608 608

  
609

  
610

  
609
        /// <summary>
610
        /// goto page and select item selected by user
611
        /// </summary>
612
        /// <param name="sender"></param>
613
        /// <param name="e"></param>
611 614
        private void RadButton_Click(object sender, RoutedEventArgs e)
612 615
        {
613 616
            var clickButtonItem = sender as RadButton;
......
621 624

  
622 625
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
623 626
                    GotoPage(Convert.ToInt32(gaza.PageNumber));
627

  
624 628
                    var data = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString(gaza.Data.ToString()); //언패킹작업
625 629
                    switch (Enum.Parse(typeof(MarkupToPDF.Controls.Common.ControlType), gaza.Data_Type.ToString()))
626 630
                    {
......
724 728
                            break;
725 729
                    }
726 730

  
731
                    this.ParentOfType<KCOM.Views.MainMenu>().SelecteItemByRect(rect);
727 732
                    this.ParentOfType<KCOM.Views.MainMenu>().zoomAndPanControl.ZoomTo(rect);
728 733
                }
729 734
                catch (Exception ex)
730 735
                {
731
                    throw;
736
                    this.ParentOfType<KCOM.Views.MainMenu>().DialogMessage_Alert(ex.Message, "Error");
732 737
                }
733
                
734
                
735 738
            }
736 739
        }
737 740

  
KCOM/Events/Move.cs
231 231
        }
232 232
        #endregion
233 233
        
234
        public void ItemRect(object control)
234
        /// <summary>
235
        /// return bounding box of given control
236
        /// </summary>
237
        /// <param name="control"></param>
238
        /// <history>humkyung 2018.06.14 return bouding box of the control</history>
239
        public Rect ItemRect(object control)
235 240
        {
236 241
            s_point = new Point();
237 242
            e_point = new Point();
238 243

  
239

  
240 244
            if (control.GetType().Name == "TextControl")
241 245
            {
242 246
                s_point.X = (control as TextControl).CanvasX;
......
254 258
                rectSize = e_point - s_point;
255 259

  
256 260
                itemRect = new Rect(s_point, new Point(s_point.X + rectSize.X, s_point.Y + rectSize.Y));
257
                return;
261
                return itemRect;
258 262
            }
259 263

  
260 264
            switch ((control as IMarkupCommonData).ControlType)
......
624 628

  
625 629
            }
626 630
            itemRect = new Rect(s_point.X, s_point.Y, rectSize.X, rectSize.Y);
631

  
632
            return itemRect;
627 633
        }
628 634

  
629 635
        public Boolean IsSelectionControl(Geometry OverViewPathData)
KCOM/Views/MainMenu.xaml.cs
2468 2468

  
2469 2469
        }
2470 2470

  
2471
        /// <summary>
2472
        /// select item which's bouding rectangle is equal to given rectangle
2473
        /// </summary>
2474
        /// <author>humkyung</author>
2475
        /// <date>2018.06.14</date>
2476
        /// <param name="rect"></param>
2477
        public void SelecteItemByRect(Rect rect)
2478
        {
2479
            multi_Undo_Data = new Multi_Undo_data();
2480

  
2481
            UndoData = new Undo_data()
2482
            {
2483
                IsUndo = false,
2484
                Event = Event_Type.Select,
2485
                EventTime = DateTime.Now,
2486
                Markup_List = new List<Multi_Undo_data>()
2487
            };
2488
           
2489
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2490

  
2491
            CommentUserInfo selected = null;
2492
            double dMinDiff = double.MaxValue;
2493
            Move tmp = new Move();
2494
            foreach (var item in Items)
2495
            {
2496
                Rect boundingBox = tmp.ItemRect(item);
2497
                double dx = rect.X - boundingBox.X;
2498
                double dy = rect.Y - boundingBox.Y;
2499
                double dxx = rect.Right - boundingBox.Right;
2500
                double dyy = rect.Bottom - boundingBox.Bottom;
2501
                double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy);
2502
                if (dDiff < dMinDiff)
2503
                {
2504
                    dMinDiff = dDiff;
2505
                    selected = item;
2506
                }
2507
            }
2508

  
2509
            if (selected != null)
2510
            {
2511
                this.ReleaseAdorner();
2512

  
2513
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2514
                adornerSet.Add(selected);
2515
                ViewerDataModel.Instance.MarkupControls_USER.Remove(selected);
2516

  
2517
                Control_Style(selected);
2518
                UndoData.Markup_List.Add(multi_Undo_Data);
2519
                multi_Undo_Data = new Multi_Undo_data();
2520

  
2521
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2522
                {
2523
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2524
                });
2525
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2526

  
2527
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2528
                SelectLayer.Children.Add(final);
2529
            }
2530
        }
2531

  
2471 2532
        private void ApplyDragSelectionRect()
2472 2533
        {
2473 2534
            multi_Undo_Data = new Multi_Undo_data();
......
2601 2662
                dragZoomBorder.Width = width;
2602 2663
                dragZoomBorder.Height = height;
2603 2664
            }
2604

  
2605

  
2606 2665
        }
2607 2666

  
2608 2667
        public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type)
......
2977 3036
                    ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2978 3037

  
2979 3038
                    SelectLayer.Children.Add(final);
2980

  
2981
                    //Control_Init(control);
2982

  
2983

  
2984

  
2985

  
2986

  
2987
                    //강인구 폰트 변경 보류
2988

  
2989
                    //if ((currentControl as TextControl) != null)
2990
                    //{
2991
                    //    if ((control as TextControl).TextStyle == FontStyles.Italic)
2992
                    //    {
2993
                    //        ViewerDataModel.Instance.checkTextStyle = true;
2994
                    //    }
2995
                    //    else
2996
                    //    {
2997
                    //        ViewerDataModel.Instance.checkTextStyle = false;
2998
                    //    }
2999

  
3000
                    //    if((currentControl as TextControl).TextStyle == FontStyles.Italic)
3001
                    //    {
3002

  
3003
                    //    }
3004
                    //    if((currentControl as TextControl).TextWeight == FontWeights.Bold)
3005
                    //    {
3006

  
3007
                    //    }
3008
                    //    if((currentControl as TextControl).UnderLine == TextDecorations.Underline)
3009
                    //    {
3010

  
3011
                    //    }
3012
                    //}
3013
                    //else if ((currentControl as ArrowTextControl) != null)
3014
                    //{
3015
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true)
3016
                    //    {
3017
                    //        (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic;
3018
                    //    }
3019
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true)
3020
                    //    {
3021
                    //        (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold;
3022
                    //    }
3023
                    //    if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true)
3024
                    //    {
3025
                    //        (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline;
3026
                    //    }
3027
                    //}
3028

  
3029
                    //mouseHandlingMode = MouseHandlingMode.Adorner;
3030 3039
                }
3031 3040
            }
3032 3041

  
......
4376 4385
                }
4377 4386

  
4378 4387
            }
4379

  
4380
            //else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting)
4381
            //{
4382
            //    if (controlType == ControlType.None)
4383
            //    {
4384
            //        mouseHandlingMode = MouseHandlingMode.Selecting;
4385
            //        this.cursor = Cursors.Arrow;
4386
            //        inkDrawingCanvas.IsEnabled = false;
4387
            //        isLeftMouseButtonDownOnWindow = true;
4388
            //    }
4389
            //}
4390

  
4391 4388
            if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left)
4392 4389
            {
4393 4390
                if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0)
......
5862 5859
                ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
5863 5860
            }
5864 5861
        }
5865

  
5866 5862
    }
5867 5863
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)