Get x1 y1 x2 y2 Coordinates of a line drawn on an Image

return getAllShapes();
}
getAllShapes().forEach(function(shape) {

  <script>
    var select = document.querySelector("#lines");
    function getAllShapes() {
  return getAllShapes();
}
    document.querySelectorAll("svg *").forEach(function(shape) {
      var option = document.createElement("option");
      if (shape.nodeName === "line") {
        option.value = shape.getAttribute("stroke");
        option.text = shape.getAttribute("stroke");
      }

Please carefully read what I said in post #1028


  <script>
    var select = document.querySelector("#lines");
    function getAllShapes() {
  return document.querySelectorAll("svg *");
}
    return getAllShapes();.forEach(function(shape) {
      var option = document.createElement("option");
      if (shape.nodeName === "line") {
        option.value = shape.getAttribute("stroke");
        option.text = shape.getAttribute("stroke");
      }
      if (shape.nodeName === "circle") {

There is a semicolon on that forEach line that doesn’t belong there.

  <script>
    var select = document.querySelector("#lines");
    function getAllShapes() {
  return document.querySelectorAll("svg *");
}
    return getAllShapes().forEach(function(shape) {
      var option = document.createElement("option");
      if (shape.nodeName === "line") {
        option.value = shape.getAttribute("stroke");
        option.text = shape.getAttribute("stroke");
      }

Is the code working now instead of being broken?

it was before I put the link in.

Good one, the dropdown box now works in the same way that it did before.

We can now move on to the final piece of getting the Active part working, which will have to wait until I get home in about an hour.

We now have two different functions, one called getAllShapes that gives us a nodeList of all the shapes in the SVG element, and the other called removeShapeWidth.

We can bring this all together by using the nodeList forEach method, giving removeShapeWidthas the callback function.

getAllShapes().forEach(removeShapeWidth);

Place that line just before the applyStrokes line on 198, and hit the Tidy button. That code should be all working with the viewed and active features on the page.

Edit:

Renamed removeStrokeWidth to removeShapeWidth

Whoops, my example code used removeStrokeWidth.

Please use removeShapeWidth in your code instead.

      }
      getAllShapes().forEach(removeStrokeWidth);
applyStrokes();
    });

Yes, please use removeShapeWidth instead of removeStrokeWidth.

Or, if you like, rename all occurrences of removeShapeWidth to removeStrokeWidth.

Just so long as one of the other is used throughout the code, but not both.

      }
      getAllShapes().forEach(removeShapeWidth);
applyStrokes();
    });

That code at that link is different from the excerpt of code that you show there.

removeStrokeWidth still hasn’t been renamed to removeShapeWidth at that link.

Good one, now back to testing. Are there any other problems with viewed or active, that can be found?