Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

[2.0.0-beta11] Cannot read property 'classType' of undefined

$
0
0

@estesbubba wrote:

I have changed from 2.0.0-beta5 to beta11 and now getting the stacktrace below. Any ideas on what has changed from beta5 to beta11 that could cause this and changes I need to make?

Uncaught TypeError: Cannot read property 'classType' of undefined
    at Ab (go-debug.js:355)
    at Lh.set (go-debug.js:29001)
    at Ej (go-debug.js:14788)
    at Jl (go-debug.js:20485)
    at Hl (go-debug.js:20449)
    at buildBaseTemplate (roundNodes.js:83)
    ...
  352 | }
  353 | 
  354 | function Ab(a, b, c, d) {
> 355 |   a.classType !== b && (c = za(c), void 0 !== d && (c += "." + d), Aa(a, "function" === "a constant of class " + typeof b.className ? b.className : "", c));
      | ^  356 | }
  357 | 
  358 | na.Object.defineProperties(D.prototype, {

Here is our code that is building the template with the stacktrace code marked with a comment.

const buildBaseTemplate = ({
  fromLinkable = true,
  toLinkable = true,
  fromLinkableSelfNode = true,
  toLinkableSelfNode = true
}) => {
  const { make } = go.GraphObject;

  return make(
    go.Node,
    'Table',
    { resizable: true },
    new go.Binding('location', 'location').makeTwoWay(),
    new go.Binding('width', 'width').makeTwoWay(),
    new go.Binding('height', 'height').makeTwoWay(),
    new go.Binding('visible', 'nodeVisible'),
    make(
      go.Panel,
      'Table',
      { row: 0, column: 0, alignment: go.Spot.Top, stretch: go.GraphObject.Fill },
      make(
        go.Panel,
        'Auto',
        { row: 0 },
        make(
          go.Shape,
          'Circle',
          {
            name: 'LinkHandle',
            portId: '',
            height: cfg.circleSize,
            width: cfg.circleSize,
            fromLinkable,
            toLinkable,
            fromLinkableSelfNode,
            toLinkableSelfNode,
            strokeWidth: 0,
            fill: 'transparent',
            cursor: 'pointer',
            mouseOver: mouseOverNode,
            mouseLeave: mouseLeaveNode
          },
          new go.Binding('fill', 'stateColor')
        ),
        make(
          go.Shape,
          'Circle',
          { height: cfg.circleSize - 20, width: cfg.circleSize - 20, strokeWidth: 0 },
          new go.Binding('fill', 'stateColor')
        ),
        make(  // <-- This is where stacktrace shows error
          go.Panel,
          'Vertical',
          { cursor: 'move' },
          make('Shape', { stroke: null, fill: '#fff' }, new go.Binding('geometry', 'iconSource'))
        )
      ),
      make(
        go.TextBlock,
        {
          row: 1,
          stretch: go.GraphObject.Fill,
          overflow: go.TextBlock.OverflowEllipsis,
          name: 'name',
          textAlign: 'center',
          editable: false,
          font: cfg.baseNodeFont,
          minSize: new go.Size(15, NaN),
          maxSize: new go.Size(76, NaN),
          cursor: 'text',
          margin: cfg.textMargin,
          stroke: cfg.textColor
        },
        new go.Binding('text', 'text').makeTwoWay()
      )
    ),

    // Badge
    make(
      'Panel',
      'Auto',
      { row: 0, column: 0, alignment: go.Spot.TopRight, margin: new go.Margin(0, 15, 0, 0), visible: false },
      new go.Binding('visible', 'badgeVisible'),
      make('Shape', 'Badge', { strokeWidth: 0, fill: '#ff3b30' }),
      make(
        'TextBlock',
        { textAlign: 'center', font: cfg.baseBadgeFont, stroke: '#fff' },
        new go.Binding('text', 'badgeText')
      )
    ),

    // Overlay
    make(
      'Panel',
      // 'Auto',
      { row: 0, column: 0, alignment: go.Spot.TopRight, margin: new go.Margin(40, 0, 0, 0) },
      new go.Binding('visible', 'overlayVisible'),
      make(
        'TextBlock',
        {
          textAlign: 'center',
          font: `${cfg.overlaySize}px workpoint`, // Need to implement this with SVG
          width: cfg.overlaySize + 2,
          height: cfg.overlaySize + 2
        },
        new go.Binding('text', 'overlayText'),
        new go.Binding('stroke', 'overlayStroke')
      )
    )
  );
};
    this.diagram = go.GraphObject.make(go.Diagram, id, {
      nodeTemplateMap: getNodeTemplateMap(theme), // <-- HERE
      linkTemplateMap: getLinkTemplateMap(theme),
      initialPosition: new go.Point(0, 0),
      isReadOnly: false,
      'undoManager.isEnabled': true,
      allowClipboard: true,
      'animationManager.isEnabled': false,
      'toolManager.mouseWheelBehavior': go.ToolManager.WheelZoom,
      'grid.visible': !!settings.showGrid,
      'grid.gridCellSize': new go.Size(gridSize, gridSize),
      'resizingTool.isGridSnapEnabled': !!settings.gridSnapOnMove,
      'draggingTool.isGridSnapEnabled': !!settings.gridSnapOnMove,
      'draggingTool.gridSnapCellSize': new go.Size(gridSnapSize, gridSnapSize),
      model
    });

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles