Skip to content

Commit

Permalink
Fixed bug where multiple event handlers were ruining the rename system
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrishnasanka committed Feb 21, 2019
1 parent 48459e2 commit 426468f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/app/view/tools/mouseSelectTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ export default class MouseSelectTool extends MouseTool {
if (target.selected) {
let feat = Registry.currentDevice.getFeatureByID(target.featureID);
Registry.viewManager.updateDefaultsFromFeature(feat);
let rightclickmenu = new RightClickMenu(feat);
rightclickmenu.show(event);
Registry.viewManager.rightClickMenu = rightclickmenu;
let rightclickmenu = Registry.viewManager.rightClickMenu; //new RightClickMenu(feat);
rightclickmenu.show(event, feat);
this.rightClickMenu = rightclickmenu;
// let func = PageSetup.getParamsWindowCallbackFunction(feat.getType(), feat.getSet());
//func(event);
Expand Down Expand Up @@ -254,7 +253,6 @@ export default class MouseSelectTool extends MouseTool {
deselectFeatures() {
if(this.rightClickMenu){
this.rightClickMenu.close();
this.rightClickMenu = null;
}
this.paperView.clearSelectedItems();
this.currentSelection = [];
Expand Down
18 changes: 10 additions & 8 deletions src/app/view/ui/rightClickMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {createFeatureTable, revertToDefaultParams} from "./parameterMenu";

export default class RightClickMenu {

constructor(feature, point){
constructor(){

this.__featureRef = feature;
this.__featureRef = null;
/*
Figure out if we can fire the parameters menu
*/
Expand All @@ -30,11 +30,6 @@ export default class RightClickMenu {
this.__collapseTextInput();



//TODO: Figure out if feature belongs to component
this.__typeString = feature.getType();
this.__setString = feature.getSet();

let ref = this;

//Event handlers
Expand Down Expand Up @@ -90,7 +85,14 @@ export default class RightClickMenu {

}

show(event){
show(event, feature){
console.log("Feature", feature);
this.__featureRef = feature;

//TODO: Figure out if feature belongs to component
this.__typeString = feature.getType();
this.__setString = feature.getSet();

this.__contextMenu.style.left = "" + (event.clientX + 30)+ "px";
this.__contextMenu.style.top = "" + (event.clientY - 20) + "px";
this.__contextMenu.style.opacity = 0.8;
Expand Down
3 changes: 2 additions & 1 deletion src/app/view/viewManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import PaperView from "./paperView";
import AdaptiveGrid from "./grid/adaptiveGrid";
import Feature from "../core/feature";
import TaguchiDesigner from "./ui/taguchiDesigner";
import RightClickMenu from "./ui/rightClickMenu";

export default class ViewManager {

Expand Down Expand Up @@ -70,7 +71,7 @@ export default class ViewManager {
this.editDeviceDialog = new EditDeviceDialog(this);
this.helpDialog = new HelpDialog();
this.taguchiDesigner = new TaguchiDesigner(this);

this.rightClickMenu = new RightClickMenu();
this.__currentDevice = null;

let reference = this;
Expand Down

0 comments on commit 426468f

Please sign in to comment.