268 WAYPOINT - 1) Reset the state to __source 2) cleanup features 3) TBA
269 TARGET - Set the state to SOURCE and do nothing else
270 */
271 switch (this.__STATE) {272 case ConnectionToolState.PLACE_FIRST_POINT:273 console.log("Doing nothing");274 break;275 case ConnectionToolState.PLACE_WAYPOINT:276 console.warn("Paused connection placement midway");277278 break;279 case ConnectionToolState.TARGET_PLACED_START_AGAIN:280 this.__STATE = ConnectionToolState.PLACE_FIRST_POINT;281 this.dragging = false;282 break;283 }284 }
285
286 /**
90 Registry.viewManager?.killParamsWindow();
91 paper.project.deselectAll();
92 console.log("Current State:", ref.__STATE);
93 switch (ref.__STATE) { 94 case ConnectionToolState.PLACE_FIRST_POINT: 95 ref.__STATE = ConnectionToolState.PLACE_WAYPOINT; 96 ref.dragging = true; 97 ref.initChannel(); 98 break; 99 case ConnectionToolState.PLACE_WAYPOINT:100 ref.addWayPoint(event as unknown as MouseEvent, (event as any).altKey);101 break;102 case ConnectionToolState.TARGET_PLACED_START_AGAIN:103 ref.__STATE = ConnectionToolState.PLACE_WAYPOINT;104 ref.dragging = true;105 ref.initChannel();106 // ref.createConnection();107 break;108 }109 };
110
111 this.rightdown = function (event) {
110
111 // console.log("Edge:", edge);
112 // console.log("Edge Type:", edge.type);
113 switch (edge.type) {114 case "LINE":115 childpath.add(new paper.Point(node.x, node.y));116 break;117 case "ARC":118 childpath.add(new paper.Point(node.x, node.y));119 const nextnode = this.__nodes.get(nextnoderef);120 const endpoint = new paper.Point(nextnode.x, nextnode.y);121 const midpoint = this.getARCMidpoint(edge.dxfData);122 childpath.arcTo(midpoint, endpoint);123 break;124 }125 }
126
127 path.addChild(childpath);
478 function onKeyDown(event) {
479 if (scope.enabled === false || scope.noKeys === true || scope.noPan === true) return;
480
481 switch (event.keyCode) { 482 case scope.keys.UP: 483 scope.pan(0, scope.keyPanSpeed); 484 scope.update(); 485 break; 486 487 case scope.keys.BOTTOM: 488 scope.pan(0, -scope.keyPanSpeed); 489 scope.update(); 490 break; 491 492 case scope.keys.LEFT: 493 scope.pan(scope.keyPanSpeed, 0); 494 scope.update(); 495 break; 496 497 case scope.keys.RIGHT: 498 scope.pan(-scope.keyPanSpeed, 0); 499 scope.update(); 500 break; 501 } 502 }
503
504 function touchstart(event) {
Some code conventions require that all switch statements have a default case, even if the default case is empty. The idea is to always explicitly state what the default behavior should be so that it's clear that the developer didn't forget to handle the default fallback case.
switch (a) {
case 1:
/* code */
break;
}
switch (a) {
case 1:
/* code */
break;
default:
/* code */
break;
}
switch (a) {
case 1:
/* code */
break;
// no default
}
switch (a) {
case 1:
/* code */
break;
// No Default
}