fixed errors VC

This commit is contained in:
Daniel Barbero Martin 2020-01-23 09:20:40 +01:00
parent 6c6403336f
commit 3124e09c12
6 changed files with 51 additions and 48 deletions

View File

@ -1,5 +1,5 @@
// TODO: Add Artica ST header. // TODO: Add Artica ST header.
/* globals jQuery, VisualConsole, AsyncTaskManager, confirmDialog */ /* globals jQuery, VisualConsole, AsyncTaskManager */
/* /*
* ********************* * *********************
@ -460,10 +460,6 @@ function createVisualConsole(
var aux = item; var aux = item;
var id = item.props.id; var id = item.props.id;
confirmDialog({
title: "Delete",
message: "Are you sure?",
onAccept: function() {
item.remove(); item.remove();
var taskId = "visual-console-item-update-" + id; var taskId = "visual-console-item-update-" + id;
@ -501,13 +497,13 @@ function createVisualConsole(
}; };
}) })
.init(); .init();
}
});
}, },
copyItem: function(item) { copyItem: function(item) {
var id = item.props.id; var id = item.props.id;
item.setMeta({ isSelected: false, isUpdating: true }); item.setMeta({ isSelected: false, isUpdating: true });
visualConsole.unSelectItem(id);
var taskId = "visual-console-item-update-" + id; var taskId = "visual-console-item-update-" + id;
// Persist the new position. // Persist the new position.
@ -569,6 +565,7 @@ function createVisualConsole(
var newItem = visualConsole.addElement(itemRetrieved); var newItem = visualConsole.addElement(itemRetrieved);
newItem.setMeta({ editMode: true, isSelected: true }); newItem.setMeta({ editMode: true, isSelected: true });
visualConsole.selectItem(newItem.props.id);
done(); done();
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -516,11 +516,17 @@ ui_require_css_file('form');
}); });
$('#button-button_delete').click(function (event){ $('#button-button_delete').click(function (event){
confirmDialog({
title: "<?php echo __('Delete'); ?>",
message: "<?php echo __('Are you sure'); ?>"+"?",
onAccept: function() {
visualConsoleManager.visualConsole.elements.forEach(item => { visualConsoleManager.visualConsole.elements.forEach(item => {
if (item.meta.isSelected === true) { if (item.meta.isSelected === true) {
visualConsoleManager.deleteItem(item); visualConsoleManager.deleteItem(item);
} }
}); });
}
});
}); });
$('#button-button_copy').click(function (event){ $('#button-button_copy').click(function (event){

View File

@ -257,7 +257,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// This function will only run the 2nd arg function after the time // This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution. // of the first arg have passed after its last execution.
private debouncedMovementSave = debounce( private debouncedMovementSave = debounce(
300, // ms. 100, // ms.
(x: Position["x"], y: Position["y"]) => { (x: Position["x"], y: Position["y"]) => {
// Update the metadata information. // Update the metadata information.
// Don't use the .meta property cause we don't need DOM updates. // Don't use the .meta property cause we don't need DOM updates.
@ -338,7 +338,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// This function will only run the 2nd arg function after the time // This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution. // of the first arg have passed after its last execution.
private debouncedResizementSave = debounce( private debouncedResizementSave = debounce(
300, // ms. 100, // ms.
(width: Size["width"], height: Size["height"]) => { (width: Size["width"], height: Size["height"]) => {
// Update the metadata information. // Update the metadata information.
// Don't use the .meta property cause we don't need DOM updates. // Don't use the .meta property cause we don't need DOM updates.

View File

@ -96,7 +96,7 @@ export default class Line extends Item<LineProps> {
// This function will only run the 2nd arg function after the time // This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution. // of the first arg have passed after its last execution.
private debouncedStartPositionMovementSave = debounce( private debouncedStartPositionMovementSave = debounce(
500, // ms. 100, // ms.
(x: Position["x"], y: Position["y"]) => { (x: Position["x"], y: Position["y"]) => {
this.isMoving = false; this.isMoving = false;
const startPosition = { x, y }; const startPosition = { x, y };
@ -154,7 +154,7 @@ export default class Line extends Item<LineProps> {
// This function will only run the 2nd arg function after the time // This function will only run the 2nd arg function after the time
// of the first arg have passed after its last execution. // of the first arg have passed after its last execution.
private debouncedEndPositionMovementSave = debounce( private debouncedEndPositionMovementSave = debounce(
500, // ms. 100, // ms.
(x: Position["x"], y: Position["y"]) => { (x: Position["x"], y: Position["y"]) => {
this.isMoving = false; this.isMoving = false;
const endPosition = { x, y }; const endPosition = { x, y };