touch: fix vector transforming (points of arrows, scribbles)

This commit is contained in:
Lukas F. Hartmann
2020-12-18 18:11:33 +01:00
parent 352b01569f
commit 386d784952
2 changed files with 26 additions and 28 deletions

View File

@@ -1019,8 +1019,7 @@ var SpacedeckSections = {
};
},
update_selection_metrics: function(arts) {
update_selection_metrics: function(arts, temporary) {
if (this.active_tool == "scribble") {
this.selection_metrics.count = 1;
return;
@@ -1053,8 +1052,6 @@ var SpacedeckSections = {
// FIXME make sure that menus fit in window
this.toolbar_props_x = pp.x+"px";
this.toolbar_props_y = pp.y+"px";
//this.hide_toolbar_artifacts();
}
this.selection_metrics.x1 = sr.x1;
@@ -1069,6 +1066,7 @@ var SpacedeckSections = {
if (!arts) arts = this.selected_artifacts();
if (!temporary) {
this.first_selected_artifact = arts[0];
this.selection_metrics.count=arts.length;
this.selection_metrics.scribble_selection = false;
@@ -1088,6 +1086,7 @@ var SpacedeckSections = {
this.selection_metrics.has_link=true;
this.insert_link_url = arts[0].meta.link_uri;
}
}
},
begin_transaction: function() {
@@ -1436,13 +1435,13 @@ var SpacedeckSections = {
this.color_picker_rgb = rgb_to_hex(rgba.r,rgba.g,rgba.b);
},
update_selected_artifacts: function(change_func, override_locked) {
update_selected_artifacts: function(change_func, override_locked, temporary) {
var artifacts = this.selected_artifacts(!override_locked);
if (!artifacts.length) return;
this.update_artifacts(artifacts, change_func);
this.update_selection_metrics();
this.update_selection_metrics(null, temporary||false);
},
nudge_selected_artifacts: function(dx, dy, event) {

View File

@@ -724,6 +724,9 @@ function setup_whiteboard_directives() {
//save_artifact(ars[i], null, $scope.display_saving_error);
}
// update vector handles
$scope.update_selection_metrics();
}
if (this.mouse_state == "text_editor") {
@@ -942,18 +945,14 @@ function setup_whiteboard_directives() {
// special case for arrow's 3rd point
if (a.shape == "arrow" && $scope.selected_control_point_idx!=2) {
/*control_points[2].dx += dx/2;
control_points[2].dy += dy/2; */
control_points[2].dx = (control_points[0].dx+control_points[1].dx)/2;
control_points[2].dy = (control_points[0].dy+control_points[1].dy)/2;
}
return _this.normalize_control_points(control_points, old_a);
});
}, false, true); // override_locked: false, temporary: true
} else if (this.mouse_state == "scribble") {
$scope.update_selected_artifacts(function(a) {
var old_a = a;