Keeping rulers the same size when zooming

one more question…
What would be the best approach that rulers always have the same size? It would be good if zoom only changes the scale.
Kind regards

Could you show some screenshots to demonstrate what you want?

Hello Walter,
I want to do it like Photoshop. The rulers keep their height, width and font size. Only the scale changes.

Thanks for your help



Perhaps something like this?

    function updateScales() {
      var vb = myDiagram.viewportBounds;
      myDiagram.startTransaction("update scales");
      // Update properties of horizontal scale to reflect viewport
      gradScaleHoriz.location = new go.Point(vb.x, vb.y);
      gradScaleHoriz.graduatedMin = vb.x;
      gradScaleHoriz.graduatedMax = vb.right;
      gradScaleHoriz.scale = 1 / myDiagram.scale;
      // Update properties of vertical scale to reflect viewport
      gradScaleVert.location = new go.Point(vb.x, vb.y);
      gradScaleVert.graduatedMin = vb.y;
      gradScaleVert.graduatedMax = vb.bottom;
      gradScaleVert.scale = 1 / myDiagram.scale;
      myDiagram.commitTransaction("update scales");
    }

    function updateIndicators() {
      var vb = myDiagram.viewportBounds;
      var mouseCoords = myDiagram.lastInput.documentPoint;
      myDiagram.startTransaction("update indicators");
      // Keep the indicators in line with the mouse as viewport changes or mouse moves
      gradIndicatorHoriz.location = new go.Point(Math.max(mouseCoords.x, vb.x), vb.y);
      gradIndicatorHoriz.scale = 1 / myDiagram.scale;
      gradIndicatorVert.location = new go.Point(vb.x, Math.max(mouseCoords.y, vb.y));
      gradIndicatorVert.scale = 1 / myDiagram.scale;
      myDiagram.commitTransaction("update indicators");
    }
  }

Thanks for the fix. Unfortunately, it works only partially.
demo

sorry. I forgot to remove the plane from the code.