Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Image nodes in network are square until interacted with #3203

@lucaswerkmeister

Description

@lucaswerkmeister

After upgrading from vis 4.19.1 to 4.20.0, images in the network visualization are squeezed to square aspect ratio until the network is somehow interacted with, at which point they assume their correct aspect ratio. (Usually the switch happens as soon as you select a node, sometimes only upon deselection.)

We can reproduce this on Firefox and Chromium (both Ubuntu Xenial).

Small reproducer:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Vis Network Image Aspect Ratio Test</title>
    <script src="node_modules/vis/dist/vis.js"></script>
    <link rel="stylesheet" href="node_modules/vis/dist/vis.css">
  </head>
  <body>
    <div id="mynetwork"></div>
    <script>
      new vis.Network(
        document.getElementById('mynetwork'),
        {
          nodes: new vis.DataSet([
            { id: 1, label: 'Test node', shape: 'image', image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Aspect-ratio-16x9.svg/320px-Aspect-ratio-16x9.svg.png' }
          ]),
          edges: new vis.DataSet([])
        },
        {}
      );
    </script>
  </body>
</html>

(Assumes that vis is in node_modules; adjust the paths in <head> if necessary.)

Before interacting with the graph:
screenshot from 2017-06-23 13-32-57
After selecting and deselecting the node:
screenshot from 2017-06-23 13-33-04

From a quick glance over the release notes, #3010 sounds like it might be responsible for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions