Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/release-v0.1' into issue-402-tut…
Browse files Browse the repository at this point in the history
…orial
  • Loading branch information
Pierre Coquet committed Sep 15, 2023
2 parents 3cf09cb + 345a83b commit 1781857
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 156 deletions.
57 changes: 54 additions & 3 deletions frontendVue3/src/classes/Commands/CommandManager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as commandFactory from "@/classes/Commands/CommandFactory";
import * as update from '@/services/FeatureModel/update.service.js';
import { getColorsFromService } from '@/services/FeatureModel/colorsFromService.service';
import { ReloadCommand } from '@/classes/Commands/ReloadCommand';

export class CommandManager {
constructor() {
Expand All @@ -12,6 +14,10 @@ export class CommandManager {
this.d3Data = null;
}

executeReload(){
this.fadeOut(this.d3Data, new ReloadCommand());
}

execute(command, initiator = true) {
if (initiator && this.collaborationManager) {
this.collaborationManager.send(this.type, 'execute', command.createDTO());
Expand Down Expand Up @@ -111,12 +117,57 @@ export class CommandManager {
}

fadeOut(d3Data, command) {
// Rerender for edits and fade them out
if(this.d3Data){
if(command instanceof ReloadCommand){
if(d3Data.coloringIndex < 1) {
getColorsFromService(this.collaborationManager.featureModel.data, d3Data).then(
value => {
if (!value) {
d3Data.coloringIndex = 0;
} else {
d3Data.coloringIndex = -1;
}
}
);
}
// Rerender for edits and fade them out
setTimeout(() => {
command.unmarkChanges();
update.updateSvg(d3Data);
}, 500);
} else if(this.type !== 'constraint') {
if(d3Data.coloringIndex < 1) {
getColorsFromService(this.collaborationManager.featureModel.data, d3Data).then(
value => {
if (!value) {
d3Data.coloringIndex = 0;
} else {
d3Data.coloringIndex = -1;
}
}
);
}
// Rerender for edits and fade them out
setTimeout(() => {
command.unmarkChanges();
update.updateSvg(d3Data);
}, 5000);
}, 3000);
} else {
if(this.collaborationManager.featureModelCommandManager.d3Data.coloringIndex < 1) {
getColorsFromService(this.collaborationManager.featureModel.data, this.collaborationManager.featureModelCommandManager.d3Data).then(
value => {
if (!value) {
this.collaborationManager.featureModelCommandManager.d3Data.coloringIndex = 0;
} else {
this.collaborationManager.featureModelCommandManager.d3Data.coloringIndex = -1;
}
}
);
}
// Rerender for edits and fade them out
setTimeout(() => {
command.unmarkChanges();
update.updateSvg(this.collaborationManager.featureModelCommandManager.d3Data);
}, 500);
}
}
}
10 changes: 10 additions & 0 deletions frontendVue3/src/classes/Commands/ReloadCommand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Command } from '@/classes/Commands/Command';

export class ReloadCommand extends Command {

execute() {
}

undo() {
}
}
6 changes: 5 additions & 1 deletion frontendVue3/src/classes/FeatureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class FeatureNode {
}else{
this.displayName= newName.slice(0, CONSTANTS.DISPLAY_NAME_RAW) + CONSTANTS.POINTS;
}

}
color() {
if (this.markedAsEdited) {
Expand Down Expand Up @@ -86,6 +86,10 @@ export class FeatureNode {
this.groupType = groupType;
}

setColor(color) {
this.colorValue = color;
}

uncollapse(toRoot = true) {
if (this.isCollapsed && !this.isLeaf()) {
this.d3Node.children = this.d3Node.collapsedChildren;
Expand Down
6 changes: 6 additions & 0 deletions frontendVue3/src/classes/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export const NODE_COLOR = "rgb(204, 204, 255)";
export const NODE_EDITED_COLOR = "rgb(197,196,120)";
export const NODE_ABSTRACT_COLOR = "#ebebff";

export const NODE_DEAD_COLOR = "rgb(255, 46, 46)";

export const NODE_FALSEOP_COLOR = "rgb(255, 153, 51)";

export const NODE_CORE_COLOR = "rgb(51, 51, 255)";

export const DISPLAY_NAME_LENGTH = 8;
export const DISPLAY_NAME_RAW= 5;
export const POINTS = '...';
Expand Down
6 changes: 4 additions & 2 deletions frontendVue3/src/components/FeatureModel/FeatureModelTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export default {
this.rootNode,
this.constraints
);
this.commandManager.executeReload();
update.updateSvg(this.d3Data);
},
Expand All @@ -281,8 +282,9 @@ export default {
},
coloring(coloringIndex) {
this.d3Data.coloringIndex = coloringIndex;
update.updateSvg(this.d3Data);
this.d3Data.coloringIndex = coloringIndex;
this.commandManager.executeReload();
update.updateSvg(this.d3Data);
},
onChangeFoundNodeIndex(index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<v-list-item-title>Redo</v-list-item-title>
</v-list-item>

<v-menu offset-y :close-on-content-click="false">
<v-menu offset-y :close-on-content-click="false" >
<template v-slot:activator="{ props }">
<v-list-item v-bind="props" prepend-icon="mdi-palette">
<v-list-item-title>Coloring</v-list-item-title>
Expand All @@ -126,7 +126,7 @@
<v-list-item
v-for="(item, i) in itemsColoring"
:key="i"
@click="selectedColoring(item)"
@click="selectedColoring(i)"
>
<v-list-item-title
>{{item}}</v-list-item-title>
Expand Down Expand Up @@ -347,13 +347,14 @@ export default {
maxChildren: 3,
spaceBetweenParentChild: 75,
spaceBetweenSiblings: 20,
itemsColoring: ['Count', 'Direct Children', 'Total Children'],
itemsColoring: ['Standard', 'Direct Children', 'Total Children'],
isShortName: false,
semanticEditing: false,
quickEdit: false,
drawer: true,
discardChangesConfirmDialog: false,
saveDialog: false,
isColorMenuOpened: false,
}),
watch: {
Expand Down
Loading

0 comments on commit 1781857

Please sign in to comment.