Skip to content

Commit

Permalink
annotations now work.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschylus committed Mar 30, 2017
1 parent e34f266 commit e058694
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions js/src/annotations/osd-svg-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,13 @@
},

resize: function() {
var _this = this;
var viewportBounds = this.viewer.viewport.getBounds(true);
console.log(viewportBounds);
var originWindow = this.state.getWindowObjectById(this.windowId);
if ( !originWindow.canvases ) { return; } // no-op if canvases are not initialised.
var currentCanvasModel = originWindow.canvases[originWindow.canvasID];

/* in viewport coordinates */
this.canvas.width = this.viewer.viewport.containerSize.x;
this.canvas.height = this.viewer.viewport.containerSize.y;
Expand All @@ -698,15 +704,16 @@
this.canvas.style.marginTop = '0px';
if (this.paperScope && this.paperScope.view) {
this.paperScope.view.viewSize = new this.paperScope.Size(this.canvas.width, this.canvas.height);
// this.paperScope.view.zoom = this.viewer.viewport.viewportToImageZoom(this.viewer.viewport.getZoom(true));
// this.paperScope.view.center = new this.paperScope.Size(
// this.viewer.world.getItemAt(0).source.dimensions.x * viewportounds.x + this.paperScope.view.bounds.width / 2,
// this.viewer.world.getItemAt(0).source.dimensions.x * viewportBounds.y + this.paperScope.view.bounds.height / 2);
this.paperScope.view.zoom = 0.2;
this.paperScope.view.center = new this.paperScope.Size(1500, 1500);
// console.log(this.paperScope.view);

this.paperScope.view.zoom = _this.canvas.width * this.viewer.viewport.getZoom(true);
this.paperScope.view.center = new this.paperScope.Size(
this.viewer.viewport.getCenter(true).x,
this.viewer.viewport.getCenter(true).y
);

console.log(this.paperScope.view.center);
console.log(this.paperScope.view.zoom);
this.paperScope.view.update(true);
// console.log(this.paperScope.view);
var allItems = this.paperScope.project.getItems({
name: /_/
});
Expand Down

0 comments on commit e058694

Please sign in to comment.