Skip to content

Commit

Permalink
Merge pull request #1168 from dondi/cecilia-1082
Browse files Browse the repository at this point in the history
#1082: Fixed Fit to Window Functionality
dondi authored Jan 29, 2025
2 parents 0f7c2f6 + 7873143 commit 2893aef
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion web-client/public/js/iframe-coordination.js
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ const sendDimensions = (destination, origin) => {
};

window.addEventListener("message", event => {
if (event.origin.indexOf("https://grnsight.lmucs.org") !== 0) {
if (event.origin !== "https://grnsight.lmucs.org") {
// Ignore any message that did not originate from the GRNsight web client server.
return;
}
2 changes: 1 addition & 1 deletion web-client/public/js/setup-handlers.js
Original file line number Diff line number Diff line change
@@ -575,7 +575,7 @@ export const setupHandlers = grnState => {
});
} else {
window.addEventListener("message", event => {
if (event.origin.indexOf(HOST_SITE) !== 0) {
if (event.origin !== HOST_SITE) {
return;
}

20 changes: 7 additions & 13 deletions web-client/public/js/update-app.js
Original file line number Diff line number Diff line change
@@ -308,20 +308,14 @@ const updateViewportSize = (currentValue) => {

let container = $(".grnsight-container");

// from jquery
const fitContainer = dimensions => {
if (!dimensions) {
return; // First call; the next one should have dimensions filled in.
}
const fitWidth = dimensions ? dimensions.width - WIDTH_OFFSET : container.width();
const fitHeight = dimensions ? dimensions.height - dimensions.top - HEIGHT_OFFSET : container.height();

const fitWidth = dimensions.width - WIDTH_OFFSET;
const fitHeight = dimensions.height - dimensions.top - HEIGHT_OFFSET;
if (fitWidth !== container.width() || fitHeight !== container.height()) {
container.css({
width: fitWidth,
height: fitHeight
});
}
container.css({
width: fitWidth,
height: fitHeight
});
};

const fitContainerToWindow = () => {
@@ -871,7 +865,7 @@ export const updateApp = grnState => {
updatetoGridLayout();
}

// Viewport
// Viewport
updateViewportSize(grnState.viewportSize);

// Node Coloring

0 comments on commit 2893aef

Please sign in to comment.