ngageoint / opensphere

OpenSphere
Apache License 2.0
185 stars 90 forks source link

Window constrain doesn't handle auto height #897

Open johnstacy opened 4 years ago

johnstacy commented 4 years ago

I'm passing a really large x and y value os.ui.window.launch() to try to launch a window in the lower right corner for a window with height: auto. When the following code runs, it doesn't work as expected because the height of the window hasn't been calculated yet so h is only 38px. Not sure if there is a good way around this...

  if (y < winContainerTop) {
    this.element.css('top', winContainerTop + 'px');
  } else if ((y + h) > size.height) {
    y = Math.max(size.height - h, winContainerTop);
    this.element.css('top', y + 'px');
  }
gregroyal commented 4 years ago

You should be able to wait until you think your window is sized, then fire the $scope.$emit(os.ui.WindowEventType.READY) from your directive thats inside the window