|
|
@@ -168,9 +168,10 @@ export default defineComponent({
|
|
|
this.timeline.clearSelectedItems();
|
|
|
this.currentCreneauGroup = this.timeline.addRessource(ressource, pos);
|
|
|
this.currentCreneauGroup.selected = true;
|
|
|
-
|
|
|
+ const finalPos = this.timeline.getRessources().findIndex((o) => o.id == ressource.id);
|
|
|
+ console.log("Position " + finalPos);
|
|
|
this.commit(MutationTypes.addCreneauGroupAt, {
|
|
|
- pos: this.timeline.getRessources().indexOf(this.currentCreneauGroup),
|
|
|
+ pos: finalPos,
|
|
|
r: this.currentCreneauGroup,
|
|
|
});
|
|
|
},
|
|
|
@@ -294,9 +295,27 @@ export default defineComponent({
|
|
|
this.zoomLevel += lvl;
|
|
|
this.zoomLevel = Math.min(Math.max(0, this.zoomLevel), durations.length - 1);
|
|
|
|
|
|
+ const scrollContainer = this.timeline.shadowRoot?.querySelector(
|
|
|
+ ".jc-timeline-grid-container .simplebar-content-wrapper"
|
|
|
+ ) as HTMLDivElement;
|
|
|
+ const newScroll =
|
|
|
+ ((scrollContainer.scrollLeft + scrollContainer.offsetWidth / 2) *
|
|
|
+ (this.slotduration / this.slotwidth)) /
|
|
|
+ (durations[this.zoomLevel] / slotWidths[this.zoomLevel]) -
|
|
|
+ scrollContainer.offsetWidth / 2;
|
|
|
+
|
|
|
this.slotduration = durations[this.zoomLevel];
|
|
|
this.slotwidth = slotWidths[this.zoomLevel];
|
|
|
this.legendspan = legendSpans[this.zoomLevel];
|
|
|
+ setTimeout(() => {
|
|
|
+ const root = this.timeline.shadowRoot;
|
|
|
+ if (root) {
|
|
|
+ root
|
|
|
+ .querySelector(".jc-timeline-grid-container .simplebar-content-wrapper")
|
|
|
+ ?.scrollTo(newScroll, 0);
|
|
|
+ root.querySelector(".jc-timeline-grid-title-container")?.scrollTo(newScroll, 0);
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
},
|
|
|
openContextMenu(e: MouseEvent) {
|
|
|
e.preventDefault();
|
|
|
@@ -365,10 +384,11 @@ export default defineComponent({
|
|
|
const ressource = this.$store.getters.getCreneauGroupById(ressourceId ?? "");
|
|
|
|
|
|
if (ressource) {
|
|
|
- const pos = this.creneauGroupList.indexOf(ressource);
|
|
|
+ const pos = this.timeline.getRessources().findIndex((o) => o.id == ressourceId);
|
|
|
const newRessource = (pos: number) => {
|
|
|
const r = new Ressource({ id: uuidv4(), title: "Nouvelle ligne" });
|
|
|
if (ressource.parent) r.parent = ressource.parent;
|
|
|
+ console.log("Nouvelle ligne en position " + pos);
|
|
|
this.registerRessource(r, pos);
|
|
|
};
|
|
|
this.contextActions = [
|