Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/app/modeler/edit-mode/edit-mode.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, HostListener, OnDestroy, ViewChild} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {NgxDropzoneChangeEvent} from 'ngx-dropzone';
import {ModelImportService} from '../model-import-service';
Expand Down Expand Up @@ -28,6 +28,12 @@ export class EditModeComponent implements AfterViewInit, OnDestroy {
) {
}

@HostListener('contextmenu', ['$event'])
onRightClick(event: MouseEvent) {
event.preventDefault();
event.stopPropagation();
}

ngAfterViewInit() {
ModelerUtils.clearSelection();
this._editModeService.contextMenuItems.subscribe(menu => {
Expand Down
8 changes: 7 additions & 1 deletion src/app/modeler/simulation-mode/simulation-mode.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AfterViewInit, Component, ElementRef, OnDestroy, ViewChild} from '@angular/core';
import {AfterViewInit, Component, ElementRef, HostListener, OnDestroy, ViewChild} from '@angular/core';
import {SimulationModeService} from './simulation-mode.service';
import {PetriflowCanvasService} from '@netgrif/petriflow.svg';
import {ModelService} from '../services/model/model.service';
Expand All @@ -20,6 +20,12 @@ export class SimulationModeComponent implements AfterViewInit, OnDestroy {
) {
}

@HostListener('contextmenu', ['$event'])
onRightClick(event: MouseEvent) {
event.preventDefault();
event.stopPropagation();
}

ngAfterViewInit() {
ModelerUtils.clearSelection();
this.simulationService.originalModel.next(this.modelService.model);
Expand Down
13 changes: 10 additions & 3 deletions src/app/modeler/simulation-mode/tool/simulation-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export abstract class SimulationTool extends CanvasListenerTool {

onPlaceUp(event: PointerEvent, place: CanvasPlace) {
super.onPlaceUp(event, place);
this.openMarkingPlaceDialog(place.modelPlace);
// do not remove this setTimout - Windows user will not be happy (context menu problem)
setTimeout(() => {
this.openMarkingPlaceDialog(place.modelPlace);
}, 0);
}

onPlaceEnter(event: MouseEvent, place: CanvasPlace) {
Expand All @@ -76,10 +79,14 @@ export abstract class SimulationTool extends CanvasListenerTool {
if (value === undefined) {
const place = this.simulationModeService.model.getPlace(reference);
if (place) {
this.openMarkingPlaceDialog(place);
setTimeout(() => {
this.openMarkingPlaceDialog(place);
}, 0);
}
} else {
this.openDataDialog(reference, value);
setTimeout(() => {
this.openDataDialog(reference, value);
}, 0);
}
}

Expand Down