These are chat archives for openseadragon/openseadragon

30th
Nov 2016
Patrick Liechty
@patrickliechty
Nov 30 2016 17:51
@iangilman I created a code pen to add an overlay that would scale. I can't get it to show up right now. I can if I put css on it.
Ian Gilman
@iangilman
Nov 30 2016 18:02
@patrickliechty Here's a fixed version: http://codepen.io/iangilman/pen/vyWabR
The big issue was that your position was a straight object rather than an OpenSeadragon.Rect. The other big issue was you weren't using the right coordinates.
Another thing was that you called viewer.getViewer().addOverlay, which isn't a thing in OSD... perhaps it was lost in the translation from your own library? At any rate, it should just be viewer.addOverlay
Ian Gilman
@iangilman
Nov 30 2016 18:10
Regarding the placement value, it should actually be OpenSeadragon.Placement.CENTER not 'CENTER', but it only works if you give a point as your location rather than a rect. In that case you need to specify the size of your overlay with CSS (or HTML content) and it won't grow and shrink as you zoom, so that's probably not what you want anyway. Just stick with the rectangle and no placement.
Patrick Liechty
@patrickliechty
Nov 30 2016 21:53
@iangilman After doing an updateOverlay, the overlay top never changes. I debugged into the code and found that this code was producing a NaN for y
_getOverlayPositionAndSize: function(viewport) {
var position = viewport.pixelFromPoint(this.location, true);
var size = this._getSizeInPixels(viewport);
this.adjust(position, size);
this.location.y equals NaN
The event that got me to this code was a zoom in
And that is why the overlay does not scale when the image scales
I will try to duplicate it in the codepen
Ian Gilman
@iangilman
Nov 30 2016 22:00
@patrickliechty With my changes you're encountering that? Yes, if you could repro it in the codepen I could take a look.
Patrick Liechty
@patrickliechty
Nov 30 2016 22:01
I am encountering it in my app
Ian Gilman
@iangilman
Nov 30 2016 22:01
...and you've brought over my changes to your codepen into your app?
Patrick Liechty
@patrickliechty
Nov 30 2016 22:03
I was already using an OpenSeadragon Rect in my app and everything else looked good. I am trying to track down some odd behavior in my app. I am trying to replicate it in the codepen, but having some trouble doing that as my app has more complicated code
Ian Gilman
@iangilman
Nov 30 2016 22:05
Cool... keep me posted! :)