mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-08 13:45:28 -05:00
merge master
This commit is contained in:
@@ -381,7 +381,7 @@ imageutils.initCoordmap = function($el, coordmap) {
|
||||
|
||||
const result = mapValues(offset_css, (value, key) => {
|
||||
const prefix = key.substring(0, 1);
|
||||
|
||||
|
||||
if (prefix === "x") {
|
||||
return offset_css[key] / pixel_scaling.x;
|
||||
} else if (prefix === "y") {
|
||||
@@ -402,7 +402,7 @@ imageutils.initCoordmap = function($el, coordmap) {
|
||||
|
||||
const result = mapValues(offset_img, (value, key) => {
|
||||
const prefix = key.substring(0, 1);
|
||||
|
||||
|
||||
if (prefix === "x") {
|
||||
return offset_img[key] * pixel_scaling.x;
|
||||
} else if (prefix === "y") {
|
||||
@@ -515,24 +515,33 @@ imageutils.initCoordmap = function($el, coordmap) {
|
||||
exports.setInputValue(inputId, null);
|
||||
return;
|
||||
}
|
||||
|
||||
const offset_css = coordmap.mouseOffsetCss(e);
|
||||
const coords = {};
|
||||
const coords_css = coordmap.mouseOffsetCss(e);
|
||||
// If outside of plotting region
|
||||
if (!coordmap.isInPanelCss(offset_css)) {
|
||||
if (!coordmap.isInPanelCss(coords_css)) {
|
||||
if (nullOutside) {
|
||||
exports.setInputValue(inputId, null);
|
||||
return;
|
||||
}
|
||||
if (clip)
|
||||
return;
|
||||
|
||||
coords.coords_css = coords_css;
|
||||
coords.coords_img = coordmap.scaleCssToImg(coords_css);
|
||||
|
||||
exports.setInputValue(inputId, coords, {priority: "event"});
|
||||
return;
|
||||
}
|
||||
if (clip && !coordmap.isInPanelCss(offset_css)) return;
|
||||
const panel = coordmap.getPanelCss(coords_css);
|
||||
|
||||
const panel = coordmap.getPanelCss(offset_css);
|
||||
const coords_img = coordmap.scaleCssToImg(coords_css);
|
||||
const coords_data = panel.scaleImgToData(coords_img);
|
||||
coords.x = coords_data.x;
|
||||
coords.y = coords_data.y;
|
||||
coords.coords_css = coords_css;
|
||||
coords.coords_img = coords_img;
|
||||
|
||||
const coords = panel.scaleImgToData(coordmap.scaleCssToImg(offset_css));
|
||||
|
||||
coords.pixelratio = coordmap.cssToImgScalingRatio();
|
||||
coords.img_css_ratio = coordmap.cssToImgScalingRatio();
|
||||
|
||||
// Add the panel (facet) variables, if present
|
||||
$.extend(coords, panel.panel_vars);
|
||||
@@ -793,7 +802,10 @@ imageutils.createBrushHandler = function(inputId, $el, opts, coordmap, outputId)
|
||||
// Add the panel (facet) variables, if present
|
||||
$.extend(coords, panel.panel_vars);
|
||||
|
||||
coords.pixelratio = coordmap.cssToImgScalingRatio();
|
||||
coords.coords_css = brush.boundsCss();
|
||||
coords.coords_img = coordmap.scaleCssToImg(coords.coords_css);
|
||||
|
||||
coords.img_css_ratio = coordmap.cssToImgScalingRatio();
|
||||
|
||||
// Add variable name mappings
|
||||
coords.mapping = panel.mapping;
|
||||
|
||||
@@ -141,30 +141,8 @@ var ShinyApp = function() {
|
||||
};
|
||||
|
||||
this.$notifyDisconnected = function() {
|
||||
|
||||
// function to normalize hostnames
|
||||
var normalize = function(hostname) {
|
||||
if (hostname === "127.0.0.1")
|
||||
return "localhost";
|
||||
else
|
||||
return hostname;
|
||||
};
|
||||
|
||||
// Send a 'disconnected' message to parent if we are on the same domin
|
||||
var parentUrl = (parent !== window) ? document.referrer : null;
|
||||
if (parentUrl) {
|
||||
// parse the parent href
|
||||
var a = document.createElement('a');
|
||||
a.href = parentUrl;
|
||||
|
||||
// post the disconnected message if the hostnames are the same
|
||||
if (normalize(a.hostname) === normalize(window.location.hostname)) {
|
||||
var protocol = a.protocol.replace(':',''); // browser compatability
|
||||
var origin = protocol + '://' + a.hostname;
|
||||
if (a.port)
|
||||
origin = origin + ':' + a.port;
|
||||
parent.postMessage('disconnected', origin);
|
||||
}
|
||||
if (window.parent) {
|
||||
window.parent.postMessage("disconnected", "*");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user