(e)
| 431 | } |
| 432 | |
| 433 | shape_mousemove(e) { |
| 434 | var mouse = this.get_mouse_info(e); |
| 435 | var params = this.getParams(); |
| 436 | |
| 437 | if (mouse.is_drag == false) |
| 438 | return; |
| 439 | if (mouse.click_valid == false) { |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | var mouse_x = Math.round(mouse.x); |
| 444 | var mouse_y = Math.round(mouse.y); |
| 445 | var click_x = Math.round(this.shape_mouse_click.x); |
| 446 | var click_y = Math.round(this.shape_mouse_click.y); |
| 447 | |
| 448 | //apply snap |
| 449 | var snap_info = this.calc_snap_position(e, mouse_x, mouse_y, config.layer.id); |
| 450 | if(snap_info != null){ |
| 451 | if(snap_info.x != null) { |
| 452 | mouse_x = snap_info.x; |
| 453 | } |
| 454 | if(snap_info.y != null) { |
| 455 | mouse_y = snap_info.y; |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | var x = Math.min(mouse_x, click_x); |
| 460 | var y = Math.min(mouse_y, click_y); |
| 461 | var width = Math.abs(mouse_x - click_x); |
| 462 | var height = Math.abs(mouse_y - click_y); |
| 463 | |
| 464 | if (e.ctrlKey == true || e.metaKey) { |
| 465 | if (width < height * this.best_ratio) { |
| 466 | width = height * this.best_ratio; |
| 467 | } |
| 468 | else { |
| 469 | height = width / this.best_ratio; |
| 470 | } |
| 471 | if (mouse_x < click_x) { |
| 472 | x = click_x - width; |
| 473 | } |
| 474 | if (mouse_y < click_y) { |
| 475 | y = click_y - height; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | //more data |
| 480 | config.layer.x = x; |
| 481 | config.layer.y = y; |
| 482 | config.layer.width = width; |
| 483 | config.layer.height = height; |
| 484 | |
| 485 | this.Base_layers.render(); |
| 486 | } |
| 487 | |
| 488 | shape_mouseup(e) { |
| 489 | var mouse = this.get_mouse_info(e); |
no test coverage detected