Disappearing top panel when using PanelExpanderButton

Hello,

Following up on my previous inquiry at Help with Node Design using PanelExpanderButton - GoJS - Northwoods Software, I am continuing to work on the design of a node using the PanelExpanderButton.

The code below is a sample based on the suggestions I received:

<!DOCTYPE html>
<html>
<head>
  <title>Minimal GoJS Sample</title>
  <!-- Copyright 1998-2024 by Northwoods Software Corporation. -->
</head>
<body>
  <div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:400px"></div>
  <textarea id="mySavedModel" style="width:100%;height:250px"></textarea>

  <!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/release/go-debug.js"></script> -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/release/go.js"></script>

  <script id="code">
const myDiagram =
  new go.Diagram("myDiagramDiv", {
      "undoManager.isEnabled": true,
      "ModelChanged": e => {     // just for demonstration purposes,
        if (e.isTransactionFinished) {  // show the model data in the page's TextArea
          document.getElementById("mySavedModel").textContent = e.model.toJson();
        }
      }
    });

const roundedRectangleParams = {
  parameter1: 2, // set the rounded corner
  spot1: go.Spot.TopLeft,
  spot2: go.Spot.BottomRight // make content 
};

myDiagram.nodeTemplate =
  new go.Node("Auto", {
      resizable: true,
      locationSpot: go.Spot.Top,
      selectionAdornmentTemplate:
        new go.Adornment('Auto')
          .add(
            new go.Shape('RoundedRectangle', { fill: null, stroke: '#7986cb', strokeWidth: 3 })
              .set(roundedRectangleParams),
            new go.Placeholder()
          ) // end Adornment
    }, new go.Binding("desiredSize", "size", go.Size.parse, go.Size.stringify)
    )
    .add(
      new go.Shape("RoundedRectangle", {
          parameter1: 2,
          fill: "white", stroke: "gray", strokeWidth: 5
        })
        .set(roundedRectangleParams),
      new go.Panel("Table", {
        stretch: go.GraphObject.Fill,
         margin: 2 })
        .add(
          new go.Panel("Auto", {
             row: 0,
             stretch: go.GraphObject.Fill
            })
            .add(
              new go.Shape("RoundedRectangle", { fill: "red", strokeWidth: 0 })
                .set(roundedRectangleParams)
                .bind("fill", "color"),
              new go.Panel("Horizontal", { margin: 4 })
                .add(
                  new go.TextBlock({
                      editable: true,
                      overflow: go.TextBlock.OverflowEllipsis,
                      font: 'bold 14px sans-serif',
                      text: "node name",
                      alignment: go.Spot.Left,
                      margin: 2
                    },
                    new go.Binding("text", "text")),
                  go.GraphObject.build("PanelExpanderButton", {
                    background: "white", alignment: go.Spot.Right
                  })
                )
            ),
          new go.Panel("Vertical", {
              row: 1,
              name: "COLLAPSIBLE",
              visible: false,
              margin: 8,
              defaultAlignment: go.Spot.Left,
              //height: 100
            })
            .add(
              new go.TextBlock("additional information 1"),
              new go.TextBlock("additional information 2")
            )
        )
    );

myDiagram.model = new go.GraphLinksModel(
[
  { key: 1, text: "Alpha", color: "lightblue" },
  { key: 2, text: "Beta", color: "orange" },
  { key: 3, text: "Gamma", color: "lightgreen" },
  { key: 4, text: "Delta", color: "red" }
],
[
  { from: 1, to: 2 },
  { from: 1, to: 3 },
  { from: 3, to: 4 },
  { from: 4, to: 1 }
]);
  </script>
</body>
</html>

I am encountering an issue where the node turns white and I can no longer interact with the PanelExpanderButton after performing the following operations.
It seems that the white RoundedRectangle shown in the following code is displayed.

      new go.Shape("RoundedRectangle", {
          parameter1: 2,
          fill: "white", stroke: "gray", strokeWidth: 5
        })
        .set(roundedRectangleParams),

How can I modify the code to resolve this problem?

Here are the steps to reproduce the issue:

  1. Click the PanelExpanderButton placed on top of the node to expand the lower panel.
  2. Click the PanelExpanderButton again to close the lower panel.
  3. Resize the node by reducing its height until it reaches a certain small size.

After performing these actions, the screen looks as follows:

image

I would appreciate your guidance on this matter.

Thank you.

That seems to be a bug. We are investigating.

We have fixed this and it will be out in the next 3.0.x release.

But it looks like you’re using 2.3. Is your project OK to upgrade to 3.0 to get this fix?

We’ve just released 3.0.14, which should fix this issue.

Thank you for your response.

However, it seems you are currently on version 2.3. Are you able to upgrade your project to 3.0 in order to receive this fix?

We are using GoJS version 2.3.12, and due to certain development limitations, we are unable to upgrade to the latest version right away.
Do you have any alternative solutions for this issue?

Could you update to a newer 2.3 version?

Thank you for your suggestion. Ideally, we would like to continue with version 2.3.12. Therefore, even upgrading to a new minor version within the 2.3 series is not feasible at this time. Would it be difficult to resolve the issue with that version?

I’d like to know why, when you are doing new development, you cannot update your dependencies.

const $ = go.GraphObject.make;

const roundedRectangleParams = {
  parameter1: 2, // set the rounded corner
  spot1: go.Spot.TopLeft,
  spot2: go.Spot.BottomRight, // make content
};

myDiagram.nodeTemplate =
  $(go.Node, 'Auto', {
      resizable: true,
      locationSpot: go.Spot.Top,
      selectionAdornmentTemplate:
        $(go.Adornment, 'Auto',
          $(go.Shape, 'RoundedRectangle', {
              fill: null,
              stroke: '#7986cb',
              strokeWidth: 3,
            },
            roundedRectangleParams),
          new go.Placeholder()
        ) // end Adornment
    },
    new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
    $(go.Shape, 'RoundedRectangle', {
        parameter1: 2,
        fill: 'white',
        stroke: 'gray',
        strokeWidth: 5,
      },
      roundedRectangleParams),
    $(go.Panel, 'Table', { stretch: go.GraphObject.Fill, margin: 2 },
      $(go.Panel, 'Auto', { row: 0, stretch: go.GraphObject.Fill },
        $(go.Shape, 'RoundedRectangle', { fill: 'red', strokeWidth: 0 },
          roundedRectangleParams,
          new go.Binding('fill', 'color')),
        $(go.Panel, 'Horizontal', { margin: 4 },
          $(go.TextBlock, {
              editable: true,
              overflow: go.TextBlock.OverflowEllipsis,
              font: 'bold 14px sans-serif',
              text: 'node name',
              alignment: go.Spot.Left,
              margin: 2,
            },
            new go.Binding('text').makeTwoWay()),
          $('PanelExpanderButton', {
            background: 'white',
            alignment: go.Spot.Right,
          })
        )
      ),
      $(go.Panel, 'Vertical', {
          row: 1,
          name: 'COLLAPSIBLE',
          visible: false,
          margin: 8,
          defaultAlignment: go.Spot.Left
        },
        $(go.TextBlock, 'additional information 1'),
        $(go.TextBlock, 'additional information 2')
      )
    )
  );

Thank you for your response.

When we undertake new development, we decide on the items we will work on in advance, typically on a semi-annual or annual basis. GoJS is being used not just for the functionalities we are currently developing but also for features that are outside of the current development scope.

We are concerned about the potential impacts of library updates (for example, issues arising from breaking changes when updating from version 2.3.12 to version 3.0.14), which could affect functionalities that are not currently in development. This would require us to allocate additional time for testing and other related tasks, which is why updates are not easily implemented.

We will consider whether we can perform the update, but just to clarify, is it correct to say that resolving the issue without an update may be difficult?

I apologize for any inconvenience my questions may cause.
Your support is greatly appreciated.

Did my most recent reply not satisfy your requirements?

I inserted the code provided in your comment (Disappearing top panel when using PanelExpanderButton - #8 by walter) into a minimal sample and checked it in the browser. However, the issue where the panel disappears when resizing and making the node smaller has not been resolved.

Of course, I understand that the issue can be resolved in the latest version. However, my initial request was to inquire whether it is possible to make it work with version 2.3.12.

The code I inserted is as follows:

<!DOCTYPE html>
<html>
<head>
  <title>Minimal GoJS Sample</title>
  <!-- Copyright 1998-2024 by Northwoods Software Corporation. -->
</head>
<body>
  <div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:400px"></div>
  <textarea id="mySavedModel" style="width:100%;height:250px"></textarea>

  <!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/release/go-debug.js"></script> -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/release/go.js"></script>

  <script id="code">
  const myDiagram =
    new go.Diagram("myDiagramDiv", {
        "undoManager.isEnabled": true,
        "ModelChanged": e => {     // just for demonstration purposes,
          if (e.isTransactionFinished) {  // show the model data in the page's TextArea
            document.getElementById("mySavedModel").textContent = e.model.toJson();
          }
        }
      });

    const $ = go.GraphObject.make;

    const roundedRectangleParams = {
      parameter1: 2, // set the rounded corner
      spot1: go.Spot.TopLeft,
      spot2: go.Spot.BottomRight, // make content
    };

    myDiagram.nodeTemplate =
      $(go.Node, 'Auto', {
          resizable: true,
          locationSpot: go.Spot.Top,
          selectionAdornmentTemplate:
            $(go.Adornment, 'Auto',
              $(go.Shape, 'RoundedRectangle', {
                  fill: null,
                  stroke: '#7986cb',
                  strokeWidth: 3,
                },
                roundedRectangleParams),
              new go.Placeholder()
            ) // end Adornment
        },
        new go.Binding('desiredSize', 'size', go.Size.parse).makeTwoWay(go.Size.stringify),
        $(go.Shape, 'RoundedRectangle', {
            parameter1: 2,
            fill: 'white',
            stroke: 'gray',
            strokeWidth: 5,
          },
          roundedRectangleParams),
        $(go.Panel, 'Table', { stretch: go.GraphObject.Fill, margin: 2 },
          $(go.Panel, 'Auto', { row: 0, stretch: go.GraphObject.Fill },
            $(go.Shape, 'RoundedRectangle', { fill: 'red', strokeWidth: 0 },
              roundedRectangleParams,
              new go.Binding('fill', 'color')),
            $(go.Panel, 'Horizontal', { margin: 4 },
              $(go.TextBlock, {
                  editable: true,
                  overflow: go.TextBlock.OverflowEllipsis,
                  font: 'bold 14px sans-serif',
                  text: 'node name',
                  alignment: go.Spot.Left,
                  margin: 2,
                },
                new go.Binding('text').makeTwoWay()),
              $('PanelExpanderButton', {
                background: 'white',
                alignment: go.Spot.Right,
              })
            )
          ),
          $(go.Panel, 'Vertical', {
              row: 1,
              name: 'COLLAPSIBLE',
              visible: false,
              margin: 8,
              defaultAlignment: go.Spot.Left
            },
            $(go.TextBlock, 'additional information 1'),
            $(go.TextBlock, 'additional information 2')
          )
        )
      );

myDiagram.model = new go.GraphLinksModel(
[
  { key: 1, text: "Alpha", color: "lightblue" },
  { key: 2, text: "Beta", color: "orange" },
  { key: 3, text: "Gamma", color: "lightgreen" },
  { key: 4, text: "Delta", color: "red" }
],
[
  { from: 1, to: 2 },
  { from: 1, to: 3 },
  { from: 3, to: 4 },
  { from: 4, to: 1 }
]);
  </script>
</body>
</html>

I don’t understand. When I try your code/sample/page, without any modifications, it works perfectly in all of the manners that I have tried.

Thank you very much for running the sample code and testing it. When other developers on our team tried it, they were able to reproduce the issue discussed in this thread.

Specifically, here are the steps we followed:

  1. We saved the previously provided code in HTML format and opened it in Edge/Chrome browsers. For example, we saved it as minimal.html and displayed it in the browser.
  2. We executed the following steps to reproduce the issue:
    a. Click the PanelExpanderButton placed on top of the node to expand the lower panel.
    b. Click the PanelExpanderButton again to close the lower panel.
    c. Resize the node by reducing its height until it reaches a certain small size.

After performing these actions, the resized node changes to white. It is important to note that simply opening and closing the panel does not trigger the issue. The problem occurs when the node is resized after closing panel.

In our planned functionality, the resizing of nodes is expected, and we would like to find a way to work around this issue.

Please let me know if there was any mistake in the confirmation steps. Thank you.

Ah, yes, with your steps I can reproduce the problem.

I have not been able to find a work-around for the bug. I believe it would be possible if you defined your own PanelLayout, but I haven’t tried that.

I really think you should update to 3.0.14. Could you at least update to 2.3.18 if we released that?

Thank you very much for your response.

I understand that there are no workarounds available for version 2.3.12.

We will seriously consider the suggestion to update to version 3.0.14. To facilitate this consideration, do you have an estimate of when Northwoods Software plans to release version 2.3.18?

We truly appreciate your detailed assistance.

We have already copied the fix into the 2.3 branch. We are now reviewing whether to backport any other bug fixes into that branch before releasing 2.3.18, which should be very soon.

Thank you for your quick response, and we appreciate that you are able to release 2.3.18 immediately. It would be helpful to us if we could only update a minor version of the software.

We would appreciate it if you could proceed with the release of 2.3.18.
Thank you very much for your response to our request.

Done: GoJS 3.0.15 and 2.3.18 released

Please tell us if it fixes the problem.

Thank you very much for releasing the new version.
I have tested it and confirmed that the issue has been resolved. Thank you!