개정판 37b65344
issue #923: refactoring codes
Change-Id: Ib17f7c46134e86d8070c2ad5d739187cbf79c7b7
KCOM/Events/Event_KeyEvent.cs | ||
---|---|---|
133 | 133 |
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
134 | 134 |
{ |
135 | 135 |
PasteCommand.Instance.Execute(); |
136 |
}
|
|
136 |
} |
|
137 | 137 |
} |
138 | 138 |
break; |
139 | 139 |
#endregion |
... | ... | |
141 | 141 |
#region 저장하기(Ctrl + S) |
142 | 142 |
case Key.S: |
143 | 143 |
{ |
144 |
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission))
|
|
144 |
if (ViewerDataModel.Instance.IsPressCtrl && (App.ViewInfo.CreateFinalPDFPermission || App.ViewInfo.NewCommentPermission)) |
|
145 | 145 |
{ |
146 | 146 |
//컨트롤을 그리는 도중일 경우 컨트롤 삭제 |
147 | 147 |
ViewerDataModel.Instance.MarkupControls_USER.Remove(this.dzMainMenu.currentControl); |
... | ... | |
155 | 155 |
|
156 | 156 |
//저장완료후 임시파일 삭제 |
157 | 157 |
TempFile.Remove(); |
158 |
}
|
|
158 |
} |
|
159 | 159 |
} |
160 | 160 |
break; |
161 | 161 |
#endregion |
... | ... | |
200 | 200 |
case Key.Escape: |
201 | 201 |
{ |
202 | 202 |
//캡쳐모드 일 경우 초기화 |
203 |
if(this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture) |
|
203 |
if (this.dzMainMenu.mouseHandlingMode == IKCOM.MouseHandlingMode.Capture)
|
|
204 | 204 |
{ |
205 | 205 |
//dzMainMenu.PN_Navi.IsEnabled = true; |
206 | 206 |
this.dzMainMenu.mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
207 | 207 |
ViewerDataModel.Instance.Capture_Opacity = 0; |
208 | 208 |
} |
209 | 209 |
|
210 |
if(Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
|
210 |
if (Common.ViewerDataModel.Instance.SelectedControl == "Batch")
|
|
211 | 211 |
{ |
212 | 212 |
this.dzMainMenu.controlType = MarkupToPDF.Controls.Common.ControlType.None; |
213 | 213 |
this.dzMainMenu.txtBatch.Visibility = Visibility.Collapsed; |
... | ... | |
290 | 290 |
case Key.NumPad4: |
291 | 291 |
case Key.NumPad5: |
292 | 292 |
case Key.NumPad6: |
293 |
case Key.NumPad8: |
|
294 |
{ |
|
295 |
if(ViewerDataModel.Instance.IsPressShift) |
|
296 |
{ |
|
297 |
if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
|
298 |
{ |
|
299 |
Point control = new Point(0, 0); |
|
300 |
double resultAngle = this.dzMainMenu.rotate.Angle; |
|
301 |
|
|
302 |
switch (e.Key) |
|
303 |
{ |
|
304 |
case Key.NumPad5: |
|
305 |
if (resultAngle == 0) control = new Point(control.X, control.Y + 5); |
|
306 |
if (resultAngle == 90) control = new Point(control.X + 5, control.Y); |
|
307 |
if (resultAngle == 180) control = new Point(control.X, control.Y - 5); |
|
308 |
if (resultAngle == 270) control = new Point(control.X - 5, control.Y); |
|
309 |
break; |
|
310 |
case Key.NumPad8: |
|
311 |
if (resultAngle == 0) control = new Point(control.X, control.Y - 5); |
|
312 |
if (resultAngle == 90) control = new Point(control.X - 5, control.Y); |
|
313 |
if (resultAngle == 180) control = new Point(control.X, control.Y + 5); |
|
314 |
if (resultAngle == 270) control = new Point(control.X + 5, control.Y); |
|
315 |
break; |
|
316 |
case Key.NumPad4: |
|
317 |
if (resultAngle == 0) control = new Point(control.X - 5, control.Y); |
|
318 |
if (resultAngle == 90) control = new Point(control.X, control.Y + 5); |
|
319 |
if (resultAngle == 180) control = new Point(control.X + 5, control.Y); |
|
320 |
if (resultAngle == 270) control = new Point(control.X, control.Y - 5); |
|
321 |
break; |
|
322 |
case Key.NumPad6: |
|
323 |
if (resultAngle == 0) control = new Point(control.X + 5, control.Y); |
|
324 |
if (resultAngle == 90) control = new Point(control.X, control.Y - 5); |
|
325 |
if (resultAngle == 180) control = new Point(control.X - 5, control.Y); |
|
326 |
if (resultAngle == 270) control = new Point(control.X, control.Y + 5); |
|
327 |
break; |
|
328 |
default: |
|
329 |
break; |
|
330 |
} |
|
331 |
|
|
332 |
|
|
333 |
foreach (var item in this.dzMainMenu.SelectLayer.Children) |
|
334 |
{ |
|
335 |
if (item.GetType().Name == "AdornerFinal") |
|
336 |
{ |
|
337 |
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
|
338 |
{ |
|
339 |
(item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
|
340 |
} |
|
341 |
else |
|
342 |
{ |
|
343 |
(item as Controls.AdornerFinal).TranslateItems(control.X, control.Y); |
|
344 |
} |
|
345 |
|
|
346 |
} |
|
347 |
} |
|
348 |
} |
|
349 |
} |
|
350 |
} |
|
351 |
break; |
|
293 |
case Key.NumPad8: |
|
352 | 294 |
case Key.Right: |
353 | 295 |
case Key.Left: |
354 | 296 |
case Key.Up: |
... | ... | |
356 | 298 |
{ |
357 | 299 |
if (this.dzMainMenu.SelectLayer.Children.Count > 0) |
358 | 300 |
{ |
359 |
Point control = new Point(0, 0); |
|
360 |
double resultAngle = this.dzMainMenu.rotate.Angle; |
|
361 |
|
|
362 |
switch (e.Key) |
|
301 |
Point? control = null; |
|
302 |
if ((((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) && (e.Key == Key.NumPad5)) || |
|
303 |
(e.Key == Key.Down)) |
|
363 | 304 |
{ |
364 |
case Key.Down: |
|
365 |
if (resultAngle == 0) control = new Point(control.X, control.Y + 5); |
|
366 |
if (resultAngle == 90) control = new Point(control.X + 5, control.Y); |
|
367 |
if (resultAngle == 180) control = new Point(control.X, control.Y - 5); |
|
368 |
if (resultAngle == 270) control = new Point(control.X - 5, control.Y); |
|
369 |
break; |
|
370 |
case Key.Up: |
|
371 |
if (resultAngle == 0) control = new Point(control.X, control.Y - 5); |
|
372 |
if (resultAngle == 90) control = new Point(control.X - 5, control.Y); |
|
373 |
if (resultAngle == 180) control = new Point(control.X, control.Y + 5); |
|
374 |
if (resultAngle == 270) control = new Point(control.X + 5, control.Y); |
|
375 |
break; |
|
376 |
case Key.Left: |
|
377 |
if (resultAngle == 0) control = new Point(control.X - 5, control.Y); |
|
378 |
if (resultAngle == 90) control = new Point(control.X, control.Y + 5); |
|
379 |
if (resultAngle == 180) control = new Point(control.X + 5, control.Y); |
|
380 |
if (resultAngle == 270) control = new Point(control.X, control.Y - 5); |
|
381 |
break; |
|
382 |
case Key.Right: |
|
383 |
if (resultAngle == 0) control = new Point(control.X + 5, control.Y); |
|
384 |
if (resultAngle == 90) control = new Point(control.X, control.Y - 5); |
|
385 |
if (resultAngle == 180) control = new Point(control.X - 5, control.Y); |
|
386 |
if (resultAngle == 270) control = new Point(control.X, control.Y + 5); |
|
387 |
break; |
|
388 |
default: |
|
389 |
break; |
|
305 |
control = new Point(0, 5); |
|
390 | 306 |
} |
391 |
|
|
392 |
foreach (var item in this.dzMainMenu.SelectLayer.Children)
|
|
307 |
else if ((((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) && (e.Key == Key.NumPad8)) || |
|
308 |
(e.Key == Key.Up))
|
|
393 | 309 |
{ |
394 |
if (item.GetType().Name == "AdornerFinal") |
|
395 |
{ |
|
396 |
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
|
397 |
{ |
|
398 |
(item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
|
399 |
} |
|
400 |
else |
|
401 |
{ |
|
402 |
(item as Controls.AdornerFinal).TranslateItems(control.X, control.Y); |
|
403 |
} |
|
404 |
|
|
405 |
} |
|
310 |
control = new Point(0, -5); |
|
406 | 311 |
} |
312 |
else if ((((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) && (e.Key == Key.NumPad4)) || |
|
313 |
(e.Key == Key.Left)) |
|
314 |
{ |
|
315 |
control = new Point(-5, 0); |
|
316 |
} |
|
317 |
else if ((((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) && (e.Key == Key.NumPad6)) || |
|
318 |
(e.Key == Key.Right)) |
|
319 |
{ |
|
320 |
control = new Point(5, 0); |
|
321 |
} |
|
322 |
if(control != null && control.HasValue) this.TranslateOrRotateItems(control.Value, this.dzMainMenu.rotate.Angle); |
|
407 | 323 |
} |
408 | 324 |
} |
409 | 325 |
break; |
... | ... | |
417 | 333 |
} |
418 | 334 |
} |
419 | 335 |
|
336 |
/// <summary> |
|
337 |
/// translate or rotate items by given pt and angle |
|
338 |
/// </summary> |
|
339 |
/// <author>humkyung</author> |
|
340 |
/// <date>2019.07.03</date> |
|
341 |
/// <param name="pt">control point</param> |
|
342 |
/// <param name="dAngle">angle in degree</param> |
|
343 |
private void TranslateOrRotateItems(Point pt, double dAngle) |
|
344 |
{ |
|
345 |
Point control = MarkupToPDF.Controls.Common.MathSet.RotateAbout(new Point(0, 0), pt, dAngle); |
|
346 |
foreach (var item in this.dzMainMenu.SelectLayer.Children) |
|
347 |
{ |
|
348 |
if (item.GetType().Name == "AdornerFinal") |
|
349 |
{ |
|
350 |
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) |
|
351 |
{ |
|
352 |
(item as Controls.AdornerFinal).MoveRotate(new System.Windows.Controls.Primitives.DragDeltaEventArgs(control.X * 2, control.Y * 2)); |
|
353 |
} |
|
354 |
else |
|
355 |
{ |
|
356 |
(item as Controls.AdornerFinal).TranslateItems(control.X, control.Y); |
|
357 |
} |
|
358 |
|
|
359 |
} |
|
360 |
} |
|
361 |
} |
|
362 |
|
|
420 | 363 |
public void KeyEventUpAction(object sender, KeyEventArgs e) |
421 | 364 |
{ |
422 | 365 |
switch (e.Key) |
내보내기 Unified diff