public void endInteraction() {
    assert scalingGroup.getParent().isManaged() == false;

    // Reverts the top stack pane : it now adjusts to the size of its children
    final StackPane contentPane = (StackPane) scrollPane.getContent();
    assert contentPane.getMinWidth() == Region.USE_PREF_SIZE;
    assert contentPane.getMinHeight() == Region.USE_PREF_SIZE;
    assert contentPane.getPrefWidth() != Region.USE_COMPUTED_SIZE;
    assert contentPane.getPrefHeight() != Region.USE_COMPUTED_SIZE;
    assert contentPane.getMaxWidth() == Region.USE_PREF_SIZE;
    assert contentPane.getMaxHeight() == Region.USE_PREF_SIZE;
    contentPane.setPrefWidth(Region.USE_COMPUTED_SIZE);
    contentPane.setPrefHeight(Region.USE_COMPUTED_SIZE);
    contentPane.setMaxWidth(Double.MAX_VALUE);
    contentPane.setMaxHeight(Double.MAX_VALUE);

    // Reverts scalingGroup setup
    scalingGroup.getParent().setManaged(true);
  }
  public void beginInteraction() {
    assert scalingGroup.getParent().isManaged();
    assert scrollPane.getContent() instanceof StackPane;

    // Makes the user design and enclosing group unmanaged so
    // that they no longer influence the scroll pane viewport.
    scalingGroup.getParent().setManaged(false);

    // Renders the top stack pane fully rigid
    final StackPane contentPane = (StackPane) scrollPane.getContent();
    assert contentPane.getMinWidth() == Region.USE_PREF_SIZE;
    assert contentPane.getMinHeight() == Region.USE_PREF_SIZE;
    assert contentPane.getPrefWidth() == Region.USE_COMPUTED_SIZE;
    assert contentPane.getPrefHeight() == Region.USE_COMPUTED_SIZE;
    assert contentPane.getMaxWidth() == Double.MAX_VALUE;
    assert contentPane.getMaxHeight() == Double.MAX_VALUE;
    contentPane.setPrefWidth(contentPane.getWidth());
    contentPane.setPrefHeight(contentPane.getHeight());
    contentPane.setMaxWidth(Region.USE_PREF_SIZE);
    contentPane.setMaxHeight(Region.USE_PREF_SIZE);
  }