mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-28 14:39:36 +01:00
Pholio - make inline comment box appear correctly
Summary: Fixes T3509. Generally tried to make the code more consistently use get_image_scale, as well as make get_image_scale aware that sometimes images need to be scaled because they're too tall (as well as too wide). Test Plan: used the file from T3509. noted comment box appearing correctly as clicked, or clicked and dragged. submitted some comments and noted the reticles moved / scaled correctly as I resized the browser window Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3509 Differential Revision: https://secure.phabricator.com/D6418
This commit is contained in:
parent
a92ef7d9a2
commit
65ab9d1780
1 changed files with 8 additions and 6 deletions
|
@ -311,6 +311,7 @@ JX.behavior('pholio-mock-view', function(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
drag_end = get_image_xy(JX.$V(e));
|
drag_end = get_image_xy(JX.$V(e));
|
||||||
|
var scale = get_image_scale();
|
||||||
|
|
||||||
resize_selection(16);
|
resize_selection(16);
|
||||||
|
|
||||||
|
@ -319,10 +320,9 @@ JX.behavior('pholio-mock-view', function(config) {
|
||||||
var dialog = JX.$H(r).getFragment().firstChild;
|
var dialog = JX.$H(r).getFragment().firstChild;
|
||||||
JX.DOM.appendContent(viewport, dialog);
|
JX.DOM.appendContent(viewport, dialog);
|
||||||
|
|
||||||
JX.$V(
|
var x = Math.min(drag_begin.x * scale, drag_end.x * scale);
|
||||||
Math.min(drag_begin.x, drag_end.x),
|
var y = Math.max(drag_begin.y * scale, drag_end.y * scale) + 4;
|
||||||
Math.max(drag_begin.y, drag_end.y) + 4
|
JX.$V(x, y).setPos(dialog);
|
||||||
).setPos(dialog);
|
|
||||||
|
|
||||||
JX.DOM.focus(JX.DOM.find(dialog, 'textarea'));
|
JX.DOM.focus(JX.DOM.find(dialog, 'textarea'));
|
||||||
};
|
};
|
||||||
|
@ -420,7 +420,7 @@ JX.behavior('pholio-mock-view', function(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function position_inline_rectangle(inline, rect) {
|
function position_inline_rectangle(inline, rect) {
|
||||||
var scale = active_image.tag.width / active_image.tag.naturalWidth;
|
var scale = get_image_scale();
|
||||||
|
|
||||||
JX.$V(scale * inline.x, scale * inline.y).setPos(rect);
|
JX.$V(scale * inline.x, scale * inline.y).setPos(rect);
|
||||||
JX.$V(scale * inline.width, scale * inline.height).setDim(rect);
|
JX.$V(scale * inline.width, scale * inline.height).setDim(rect);
|
||||||
|
@ -443,7 +443,9 @@ JX.behavior('pholio-mock-view', function(config) {
|
||||||
|
|
||||||
function get_image_scale() {
|
function get_image_scale() {
|
||||||
var img = active_image.tag;
|
var img = active_image.tag;
|
||||||
return img.width / img.naturalWidth;
|
return Math.min(
|
||||||
|
img.width / img.naturalWidth,
|
||||||
|
img.height / img.naturalHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
function redraw_selection() {
|
function redraw_selection() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue