Skip to content

Commit

Permalink
Merge pull request #944 from dicksonlaw583/annotation_box_fix
Browse files Browse the repository at this point in the history
Fixed alignment of annotation boxes.
  • Loading branch information
aeschylus committed Jun 1, 2016
2 parents 6cf7f91 + 9184578 commit 371be47
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions js/src/annotations/osd-svg-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@
var _this = this;
this.state = state;
this.eventEmitter = eventEmitter;
this.viewer.addHandler('animation', function() {
var _thisResize = function() {
_this.resize();
});
this.viewer.addHandler('open', function() {
_this.resize();
});
this.viewer.addHandler('animation-finish', function() {
_this.resize();
});
this.viewer.addHandler('update-viewport', function() {
_this.resize();
});
};
this.viewer.addHandler('animation', _thisResize);
this.viewer.addHandler('open', _thisResize);
this.viewer.addHandler('animation-finish', _thisResize);
this.viewer.addHandler('update-viewport', _thisResize);
this.viewer.addHandler('resize', _thisResize);
this.viewer.addHandler('rotate', _thisResize);
this.viewer.addHandler('constrain', _thisResize);


_this.eventEmitter.subscribe('toggleDrawingTool.' + _this.windowId, function(event, tool) {
jQuery('#' + osdViewerId).parent().find('.hud-container').find('.draw-tool').removeClass('selected');
if (_this.disabled) {
Expand Down Expand Up @@ -285,7 +285,7 @@
var maxSize = 2048;
var realSize = {
width: this.viewer.viewport.containerSize.x / viewportBounds.width,
height: this.viewer.viewport.containerSize.y / viewportBounds.height,
height: this.viewer.viewport.containerSize.x / viewportBounds.width / this.viewer.viewport.contentAspectX,
offsetX: 0,
offsetY: 0,
scale: 1
Expand Down Expand Up @@ -412,12 +412,12 @@
// creating shapes used for backward compatibility.
// shape coordinates are viewport coordinates.
createRectangle: function(shape, annotation) {
var scale = this.viewer.viewport.containerSize.x;
var paperItems = [];
var rect = new $.Rectangle();
var newShape = this.viewer.viewport.viewportToImageRectangle(shape);
var initialPoint = {
'x': shape.x * scale,
'y': shape.y * scale
'x': newShape.x,
'y': newShape.y
};
var currentMode = this.mode;
var currentPath = this.path;
Expand All @@ -431,8 +431,8 @@
this.path = rect.createShape(initialPoint, this);
var eventData = {
'delta': {
'x': shape.width * scale,
'y': shape.height * scale
'x': newShape.width,
'y': newShape.height
}
};
rect.onMouseDrag(eventData, this);
Expand Down

0 comments on commit 371be47

Please sign in to comment.