Skip to content

Commit

Permalink
#1223 Maintain current default setting for enableInteractionType in c… (
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlyn authored Oct 26, 2022
1 parent cfeb752 commit 6ad5bf4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const NOTIFICATION_ICON_CLASS = "notificationCounterIcon";
// Values for enableInteractionType config parameter
export const INTERACTION_MOUSE = "Mouse";
export const INTERACTION_TRACKPAD = "Trackpad";
export const INTERACTION_LEGACY = "Legacy";
export const INTERACTION_CARBON = "Carbon";

// Values for enableLinkType config parameter
export const LINK_TYPE_CURVE = "Curve";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { ASSOC_RIGHT_SIDE_CURVE, ASSOCIATION_LINK, NODE_LINK, COMMENT_LINK,
CONTEXT_MENU_BUTTON, DEC_LINK, DEC_NODE, LEFT_ARROW_ICON, EDIT_ICON,
NODE_MENU_ICON, SUPER_NODE_EXPAND_ICON, PORT_OBJECT_CIRCLE, PORT_OBJECT_IMAGE,
TIP_TYPE_NODE, TIP_TYPE_PORT, TIP_TYPE_DEC, TIP_TYPE_LINK,
INTERACTION_MOUSE, INTERACTION_TRACKPAD, INTERACTION_LEGACY,
INTERACTION_MOUSE, INTERACTION_TRACKPAD, INTERACTION_CARBON,
USE_DEFAULT_ICON, USE_DEFAULT_EXT_ICON,
SUPER_NODE, SNAP_TO_GRID_AFTER, SNAP_TO_GRID_DURING,
NORTH, SOUTH, EAST, WEST }
Expand Down Expand Up @@ -296,7 +296,7 @@ export default class SVGCanvasRenderer {
// with regular Mouse interation that the space bar is pressed or with
// legacy interation it means the shift key is NOT pressed.
isDragActivated(d3Event) {
if (this.config.enableInteractionType === INTERACTION_MOUSE) {
if (this.config.enableInteractionType === INTERACTION_CARBON) {
return this.isSpaceKeyPressed();
}
return (d3Event && d3Event.sourceEvent && !d3Event.sourceEvent.shiftKey);
Expand Down Expand Up @@ -1884,11 +1884,11 @@ export default class SVGCanvasRenderer {
if (this.zoomingAction) {
return false;

} else if (this.config.enableInteractionType === INTERACTION_LEGACY &&
} else if (this.config.enableInteractionType === INTERACTION_MOUSE &&
(d3Event && d3Event.sourceEvent && d3Event.sourceEvent.shiftKey)) {
return true;

} else if (this.config.enableInteractionType === INTERACTION_MOUSE &&
} else if (this.config.enableInteractionType === INTERACTION_CARBON &&
!this.isSpaceKeyPressed(d3Event)) {
return true;

Expand Down
4 changes: 2 additions & 2 deletions canvas_modules/harness/cypress/integration/canvas/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe("Test to see if regular selection and drag behavior works " +

it("Test node cannot be dragged when enableEditingActions is false", function() {

cy.setCanvasConfig({ "selectedEditingActions": false });
cy.setCanvasConfig({ "selectedEditingActions": false, "selectedInteractionType": "Carbon" });

// Verify initial positon of Execution Node
cy.verifyNodeTransform("Execution node", 297, 139);
Expand All @@ -129,7 +129,7 @@ describe("Test to see if regular selection and drag behavior works " +

it("Test comment cannot be dragged when enableEditingActions is false", function() {

cy.setCanvasConfig({ "selectedEditingActions": false });
cy.setCanvasConfig({ "selectedEditingActions": false, "selectedInteractionType": "Carbon" });

// Verify initial positon of Comment
cy.verifyCommentTransform(
Expand Down
2 changes: 2 additions & 0 deletions canvas_modules/harness/cypress/integration/canvas/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ describe("Test for toolbar add comment", function() {

it("Add comments using toolbar in regular canvas and extra canvas, verify comment transform, " +
"zoom-in and zoom-out using toolbar in regular canvas and extra canvas", function() {
cy.setCanvasConfig({ "selectedInteractionType": "Carbon" });

// Add first comment using toolbar
cy.clickToolbarAddComment();
cy.editTextInComment("", "Comment 1");
Expand Down
2 changes: 2 additions & 0 deletions canvas_modules/harness/cypress/integration/canvas/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ describe("should test zoomTo function sets the appropriate zoom object", functio
});

it("Test ZoomTo function with x,y parameters after panning the canvas", function() {
cy.setCanvasConfig({ "selectedInteractionType": "Carbon" });

cy.verifyCanvasTransform(undefined);
// Panning the canvas.
cy.panCanvasToPosition(350, 200);
Expand Down
1 change: 1 addition & 0 deletions canvas_modules/harness/src/client/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,7 @@ class App extends React.Component {

getCanvasConfig2() {
const canvasConfig2 = {
enableInteractionType: this.state.selectedInteractionType,
enableNodeFormatType: this.state.selectedNodeFormatType,
enableLinkType: this.state.selectedLinkType,
enableParentClass: this.getParentClass(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
HORIZONTAL_FORMAT,
INTERACTION_MOUSE,
INTERACTION_TRACKPAD,
INTERACTION_LEGACY,
INTERACTION_CARBON,
CURVE_LINKS,
ELBOW_LINKS,
STRAIGHT_LINKS,
Expand Down Expand Up @@ -938,8 +938,8 @@ export default class SidePanelForms extends React.Component {
labelText={INTERACTION_MOUSE}
/>
<RadioButton
value={INTERACTION_LEGACY}
labelText={INTERACTION_LEGACY}
value={INTERACTION_CARBON}
labelText={INTERACTION_CARBON}
/>
<RadioButton
value={INTERACTION_TRACKPAD}
Expand Down
2 changes: 1 addition & 1 deletion canvas_modules/harness/src/client/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ _defineConstant("AFTER_DRAG", "After");

_defineConstant("INTERACTION_MOUSE", "Mouse");
_defineConstant("INTERACTION_TRACKPAD", "Trackpad");
_defineConstant("INTERACTION_LEGACY", "Legacy");
_defineConstant("INTERACTION_CARBON", "Carbon");

_defineConstant("VERTICAL_FORMAT", "Vertical");
_defineConstant("HORIZONTAL_FORMAT", "Horizontal");
Expand Down

0 comments on commit 6ad5bf4

Please sign in to comment.