Skip to content

Commit

Permalink
Merge branch 'main' into rc-v1.9.0
Browse files Browse the repository at this point in the history
* main:
  Click handler on scaled image getting clipped (#4094)
  • Loading branch information
schloerke committed Jul 26, 2024
2 parents 81f1523 + 15b5fa6 commit 7db90b1
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 18 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ If either 1 or 2 leads to undesirable behavior in your app, you can disable them
* Output bindings that are removed, invalidated, then inserted again (while invalidated) now correctly include the `.recalculating` CSS class. (#4039)

* Fixed a recent issue with `uiOutput()` and `conditionalPanel()` not properly lower opacity when recalculation (in a Bootstrap 5 context). (#4027)
* Image outputs that were scaled by CSS had certain regions that were unresponsive to hover/click/brush handlers. (#3234)

# shiny 1.8.1.1

Expand Down
13 changes: 9 additions & 4 deletions inst/www/shared/shiny.js
Original file line number Diff line number Diff line change
Expand Up @@ -14507,8 +14507,8 @@
var bounds = {
top: 0,
left: 0,
right: img.clientWidth - 1,
bottom: img.clientHeight - 1
right: img.naturalWidth - 1,
bottom: img.naturalHeight - 1
};
coordmap_.panels[0] = {
domain: bounds,
Expand Down Expand Up @@ -14581,10 +14581,15 @@
};
var matches = [];
var dists = [];
var b3;
var i5;
for (i5 = 0; i5 < coordmap.panels.length; i5++) {
b3 = coordmap.panels[i5].range;
var panelRange = coordmap.panels[i5].range;
var b3 = {
top: panelRange.top * cssToImgRatio.y,
bottom: panelRange.bottom * cssToImgRatio.y,
left: panelRange.left * cssToImgRatio.x,
right: panelRange.right * cssToImgRatio.x
};
if (x2 <= b3.right + expandImg.x && x2 >= b3.left - expandImg.x && y4 <= b3.bottom + expandImg.y && y4 >= b3.top - expandImg.y) {
matches.push(coordmap.panels[i5]);
var xdist = 0;
Expand Down
6 changes: 3 additions & 3 deletions inst/www/shared/shiny.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/www/shared/shiny.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/www/shared/shiny.min.js.map

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions srcts/src/imageutils/initCoordmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ function initCoordmap(
const bounds = {
top: 0,
left: 0,
right: img.clientWidth - 1,
bottom: img.clientHeight - 1,
right: img.naturalWidth - 1,
bottom: img.naturalHeight - 1,
};

coordmap_.panels[0] = {
Expand Down Expand Up @@ -290,11 +290,16 @@ function initCoordmap(

const matches = []; // Panels that match
const dists = []; // Distance of offset to each matching panel
let b;
let i;

for (i = 0; i < coordmap.panels.length; i++) {
b = coordmap.panels[i].range;
const panelRange = coordmap.panels[i].range;
const b = {
top: panelRange.top * cssToImgRatio.y,
bottom: panelRange.bottom * cssToImgRatio.y,
left: panelRange.left * cssToImgRatio.x,
right: panelRange.right * cssToImgRatio.x,
};

if (
x <= b.right + expandImg.x &&
Expand Down Expand Up @@ -413,5 +418,5 @@ function initCoordmap(
return coordmap;
}

export { findOrigin, initCoordmap };
export type { Coordmap, CoordmapInit };
export { initCoordmap, findOrigin };
2 changes: 1 addition & 1 deletion srcts/types/src/imageutils/initCoordmap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ type Coordmap = {
mouseCoordinateSender: (inputId: string, clip?: boolean, nullOutside?: boolean) => (e: JQuery.MouseDownEvent | JQuery.MouseMoveEvent | null) => void;
};
declare function initCoordmap($el: JQuery<HTMLElement>, coordmap_: CoordmapInit): Coordmap;
export { findOrigin, initCoordmap };
export type { Coordmap, CoordmapInit };
export { initCoordmap, findOrigin };
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ __metadata:
peerDependenciesMeta:
jquery-ui:
optional: true
checksum: ba260ba5804c16b1455ff79f9d00ce860e12ae36e29d7a5f702da6b384c9454497421b8e06fe683d10fac53e2dc6ec008da4fa129a153cbbfe5396e027eb4247
checksum: 8718ebda1068894fc1267459b603f492045723ed1000fdbe798f2fab78fed8536b1906f56c53e9bd0ff9dce24aed176045618d0a1eddcf48f7d0313ad4ad67e9
languageName: node
linkType: hard

Expand Down

0 comments on commit 7db90b1

Please sign in to comment.