fasdfsa commited on
Commit
797c587
·
1 Parent(s): b06e1a9
src/WpfEditor/MainWindow.xaml.cs CHANGED
@@ -416,11 +416,15 @@ namespace WpfEditor
416
 
417
  var (jsn, m5, pth_img, pth_json) = Global.img_md5_jsn(openFileDialog.FileName);
418
 
 
 
 
 
419
  if (this._mode == EditorMode.ImageOCR)
420
  {
421
  try
422
  {
423
- Editor._pthimg = openFileDialog.FileName;
424
  Editor.SetText(jsn, m5);
425
 
426
  _currentFilePath = openFileDialog.FileName;
@@ -435,8 +439,6 @@ namespace WpfEditor
435
  } else if (this._mode == EditorMode.ReviseEdit)
436
  {
437
  // 整理校对模式要手动框选才出字
438
- Editor._jsn_OpenImg = jsn;
439
- Editor._md5_OpenImg = m5;
440
 
441
  string b64_str = File.ReadAllText(pth_img, Encoding.UTF8);
442
  byte[] img_bytes = Base64.Base64Decode(b64_str);
 
416
 
417
  var (jsn, m5, pth_img, pth_json) = Global.img_md5_jsn(openFileDialog.FileName);
418
 
419
+ Editor._pthimg = openFileDialog.FileName;
420
+ Editor._jsn_OpenImg = jsn;
421
+ Editor._md5_OpenImg = m5;
422
+
423
  if (this._mode == EditorMode.ImageOCR)
424
  {
425
  try
426
  {
427
+
428
  Editor.SetText(jsn, m5);
429
 
430
  _currentFilePath = openFileDialog.FileName;
 
439
  } else if (this._mode == EditorMode.ReviseEdit)
440
  {
441
  // 整理校对模式要手动框选才出字
 
 
442
 
443
  string b64_str = File.ReadAllText(pth_img, Encoding.UTF8);
444
  byte[] img_bytes = Base64.Base64Decode(b64_str);
src/WpfEditor/TextEditorControl.cs CHANGED
@@ -593,31 +593,6 @@ namespace WpfEditor
593
  }
594
  }
595
 
596
- //protected override void OnMouseDown(MouseButtonEventArgs e)
597
- //{
598
- // base.OnMouseDown(e);
599
- // Focus();
600
- // Point position = e.GetPosition(this);
601
- // SetCursorPositionFromPoint(position);
602
- // if (Keyboard.Modifiers != ModifierKeys.Shift)
603
- // {
604
- // //ClearSelection();
605
- // }
606
- // else
607
- // {
608
- // UpdateSelection();
609
- // }
610
-
611
- // // 图片中框选光标后面的第一个字符
612
- // if (e.ChangedButton == MouseButton.Left && e.ButtonState == MouseButtonState.Pressed)
613
- // {
614
- // showCurrChar();
615
- // }
616
-
617
- // e.Handled = true;
618
- // InvalidateVisual();
619
- //}
620
-
621
  protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
622
  {
623
  base.OnMouseLeftButtonDown(e);
@@ -895,17 +870,33 @@ namespace WpfEditor
895
  {
896
  Rune rune = Rune.GetRuneAt(text, i);
897
 
898
- var chr = new TextCharacter(
899
- rune,
900
- c.guid,
901
- c.x,
902
- c.y,
903
- c.w,
904
- c.h,
905
- c.ImageMD5
906
- );
907
- characters.Add(chr);
908
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
909
  i += rune.Utf16SequenceLength;
910
  }
911
 
 
593
  }
594
  }
595
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
597
  {
598
  base.OnMouseLeftButtonDown(e);
 
870
  {
871
  Rune rune = Rune.GetRuneAt(text, i);
872
 
873
+ if (c != null)
874
+ {
875
+ var chr = new TextCharacter(
876
+ rune,
877
+ c.guid,
878
+ c.x,
879
+ c.y,
880
+ c.w,
881
+ c.h,
882
+ c.ImageMD5
883
+ );
884
+ characters.Add(chr);
885
+
886
+ }
887
+ else
888
+ {
889
+ var chr = new TextCharacter(
890
+ rune,
891
+ Guid.NewGuid().ToString(),
892
+ - 1,
893
+ -1,
894
+ -1,
895
+ -1,
896
+ ""
897
+ );
898
+ characters.Add(chr);
899
+ }
900
  i += rune.Utf16SequenceLength;
901
  }
902