soiz1 commited on
Commit
016d4b8
·
verified ·
1 Parent(s): 274bd92

Update src/engine/runtime.js

Browse files
Files changed (1) hide show
  1. src/engine/runtime.js +19 -5
src/engine/runtime.js CHANGED
@@ -1784,8 +1784,14 @@ class Runtime extends EventEmitter {
1784
  }
1785
  }
1786
 
1787
- if (typeof blockInfo.blockShape === 'number') {
1788
- blockJSON.outputShape = blockInfo.blockShape;
 
 
 
 
 
 
1789
  }
1790
  if (blockInfo.forceOutputType) {
1791
  blockJSON.output = blockInfo.forceOutputType;
@@ -1964,8 +1970,16 @@ class Runtime extends EventEmitter {
1964
  // shaped like a hexagon
1965
  argJSON.check = argInfo.check || argTypeInfo.check;
1966
  }
1967
- if (argInfo.shape) {
1968
- argJSON.shape = argInfo.shape;
 
 
 
 
 
 
 
 
1969
  }
1970
 
1971
  let valueName;
@@ -3175,7 +3189,7 @@ class Runtime extends EventEmitter {
3175
  if (this.stageWidth !== width || this.stageHeight !== height) {
3176
  const deltaX = width - this.stageWidth;
3177
  const deltaY = height - this.stageHeight;
3178
- // Preserve monitor location relative to the center of the stage
3179
  if (this._monitorState.size > 0) {
3180
  const offsetX = deltaX / 2;
3181
  const offsetY = deltaY / 2;
 
1784
  }
1785
  }
1786
 
1787
+ const blockShape = blockInfo.blockShape;
1788
+ if (typeof blockShape === 'number') blockJSON.outputShape = blockShape;
1789
+ else if (typeof blockShape === 'string') {
1790
+ // assume we are handling a custom shape...
1791
+ // if it doesnt exist it will default to a round reporter
1792
+ if (blockShape.startsWith('native-')) blockJSON.outputShape = blockShape;
1793
+ else if (!blockShape.startsWith('custom-')) blockJSON.outputShape = 'custom-' + blockShape;
1794
+ else blockJSON.outputShape = blockShape;
1795
  }
1796
  if (blockInfo.forceOutputType) {
1797
  blockJSON.output = blockInfo.forceOutputType;
 
1970
  // shaped like a hexagon
1971
  argJSON.check = argInfo.check || argTypeInfo.check;
1972
  }
1973
+ const argShape = argInfo.shape;
1974
+ if (argShape) {
1975
+ if (typeof argShape === 'number') argJSON.shape = argShape;
1976
+ else {
1977
+ // assume we are handling a custom shape...
1978
+ // if it doesnt exist it will default to a null input
1979
+ if (argShape.startsWith('native-')) argJSON.shape = argShape;
1980
+ else if (!argShape.startsWith('custom-')) argJSON.shape = 'custom-' + argShape;
1981
+ else argJSON.shape = argShape;
1982
+ }
1983
  }
1984
 
1985
  let valueName;
 
3189
  if (this.stageWidth !== width || this.stageHeight !== height) {
3190
  const deltaX = width - this.stageWidth;
3191
  const deltaY = height - this.stageHeight;
3192
+ // Preserve monitor __cpLocation relative to the center of the stage
3193
  if (this._monitorState.size > 0) {
3194
  const offsetX = deltaX / 2;
3195
  const offsetY = deltaY / 2;