diff --git a/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html b/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html index a294f7d7f..088a20ff7 100644 --- a/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html +++ b/vspace/src/main/webapp/WEB-INF/views/staff/spaces/space.html @@ -27,8 +27,8 @@ var selectedExternalLinkId; const displaceUnpublishedOnX = 25 const displaceUnpublishedOnY = 13 -const displaceUnpublishedOnXModal = 75 -const displaceUnpublishedOnYModal = 35 +const displaceUnpublishedOnXModal = 50 +const displaceUnpublishedOnYModal = 13 const displaceLableOnX = 10 const displaceLableOnY = 35 @@ -261,6 +261,7 @@ function showSpaceLink(spaceLink, show, x, y) { $("#space_label").remove(); $("#link").remove(); + $("#undefined").remove(); var posX = $("#bgImage").position().left; var posY = $("#bgImage").position().top; var space_label = $("

"); @@ -277,7 +278,7 @@ 'transform': 'rotate(0deg)', 'color': 'grey' }); - link = $(''); + link = $(''); } if(show) { var unpublishedSpaceElement; @@ -290,12 +291,14 @@ unpublishedSpaceElement.css('font-size', "24px"); }else{ $('[data-link-id="unpublished-' + spaceLink["id"] + '"]').remove(); - } + } + link.css('top', spaceLink["y"] + posY); + } else { + link.css('top', spaceLink["y"]); } link.css('position', 'absolute'); link.css('left', spaceLink["x"] + posX); - link.css('top', spaceLink["y"] + posY); link.css('color', 'rgba(128,128,128,1)'); link.css('transform', 'rotate(' +$('#spaceLinkRotation').val()+ 'deg)'); link.css('font-size', "12px"); @@ -323,6 +326,7 @@ function showModuleLink(moduleLink, show, x, y) { $("#module_label").remove(); $("#link").remove(); + $("#undefined").remove(); var posX = $("#bgImage").position().left; var posY = $("#bgImage").position().top; var module_label = $("

"); @@ -338,18 +342,18 @@ 'position': 'absolute', 'font-size': "10px", 'transform': 'rotate(0deg)', - 'left': x + posX - displaceLableOnX, - 'top': y + posY + displaceLableOnY, 'color': 'red' }); - link = $(''); + link = $(''); } if(show) { link.find("div").css('fill', 'red'); + link.css('top', moduleLink["y"] + posY); + } else { + link.css('top', moduleLink["y"]); } link.css('position', 'absolute'); link.css('left', moduleLink["x"] + posX); - link.css('top', moduleLink["y"] + posY); link.css('color', 'red'); link.css('transform', 'rotate(' +$('#moduleLinkRotation').val()+ 'deg)'); link.css('font-size', "12px"); @@ -402,7 +406,7 @@ } $(selectedUnpublishedIconClass).css({ 'transform': 'rotate(' + parseInt(spaceLink["rotation"]) + 'deg)'}); $(selectedUnpublishedIconClass).css({ 'position': 'absolute'}); - $(selectedUnpublishedIconClass).css({ 'left': posX - displaceUnpublishedOnXModal}); + $(selectedUnpublishedIconClass).css({ 'left': posX + displaceUnpublishedOnXModal}); $(selectedUnpublishedIconClass).css({ 'top': posY - displaceUnpublishedOnYModal}); updateLinkProperties(selectedLinkClass,selectedLabelClass,spaceLink["rotation"],posX,posY,spaceLink["spaceLinkLabel"]); } @@ -418,12 +422,12 @@ function updateLinkProperties(selectedLinkClass,selectedLabelClass,rotation,x,y,linkLabel, show){ var posX, posY; if(show) { - posx = $("#main-bgImage").position().left; + posX = $("#main-bgImage").position().left; posY = $("#main-bgImage").position().top; } else{ posX = $("#bgImage").position().left; - posY = $("#bgImage").position().top; + posY = 0 } $(selectedLinkClass).css({ 'transform': 'rotate(' + rotation + 'deg)'}); $(selectedLinkClass).css({ 'position': 'absolute'}); @@ -448,6 +452,7 @@ function showExternalLinks(externalLink, show, x, y) { $("#ext_label").remove(); $("#link").remove(); + $("#undefined").remove(); var posX = $("#bgImage").position().left; var posY = $("#bgImage").position().top; var ext_label = $("

"); @@ -461,16 +466,19 @@ 'position': 'absolute', 'font-size': "12px", 'transform': 'rotate(0deg)', - 'left': x + posX - displaceLableOnX, - 'top': y + posY + displaceLableOnY, 'color': 'blue' }); - link = $(''); + link = $(''); + } + + if(show) { + link.css('top', externalLink["y"] + posY); + } else { + link.css('top', externalLink["y"]); } link.css('position', 'absolute'); link.css('left', externalLink["x"] + posX); - link.css('top', externalLink["y"] + posY); link.css('color', 'blue'); link.css('font-size', "12px"); @@ -592,7 +600,7 @@ var posX = $(this).position().left; var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; + storeY = e.pageY - $(this).offset().top + 25; showSpaceLinkEdit(editSpaceLinkInfo(),false, storeX,storeY); }); hideLinkInfoTabs(); @@ -630,7 +638,7 @@ var posX = $(this).position().left; var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; + storeY = e.pageY - $(this).offset().top + 25; showModuleLinkEdit(editModuleLinkInfo(), false, storeX,storeY); }); hideLinkInfoTabs(); @@ -662,7 +670,7 @@ var posX = $(this).position().left; var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; + storeY = e.pageY - $(this).offset().top + 25; showExternalLinkEdit(editExternalLinkInfo(), false, storeX,storeY); }); hideLinkInfoTabs(); @@ -711,8 +719,8 @@ var posX = $(this).position().left; var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; - showSpaceLink(createSpaceLinkInfo(), false, storeX+$("#space").scrollLeft(), storeY+$("#space").scrollTop()); + storeY = e.pageY - $(this).offset().top + 25; + showSpaceLink(createSpaceLinkInfo(), false, storeX, storeY); }); hideLinkInfoTabs(); displayForms("#createSpaceLinkAlert"); @@ -730,9 +738,9 @@ var posX = $(this).position().left; var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; + storeY = e.pageY - $(this).offset().top + 25; - showModuleLink(createModuleLinkInfo(), false, storeX+$("#space").scrollLeft(), storeY+$("#space").scrollTop()); + showModuleLink(createModuleLinkInfo(), false, storeX, storeY); }); hideLinkInfoTabs(); displayForms("#createModuleLinkAlert"); @@ -751,9 +759,9 @@ var posX = $(this).position().left var posY = $(this).position().top; storeX = e.pageX - $(this).offset().left; - storeY = e.pageY - $(this).offset().top; + storeY = e.pageY - $(this).offset().top + 25; - showExternalLinks(createExternalLinkInfo(), false, storeX+$("#space").scrollLeft(), storeY+$("#space").scrollTop()); + showExternalLinks(createExternalLinkInfo(), false, storeX, storeY); }); hideLinkInfoTabs(); displayForms("#createExternalLinkAlert"); @@ -771,6 +779,7 @@ $("#createSpaceLinkBtn").click(function(e) { e.preventDefault(); $('#errorAlert').hide(); + $("#space").scrollTop(0); var label = $("#spaceLinkLabel").val(); var spaceName = $("#linkedSpace option:selected").text(); var type = $("#type option:selected").text(); @@ -800,8 +809,8 @@ } $("#spaceLinkX").val(storeX); - $("#spaceLinkY").val(storeY); - + $("#spaceLinkY").val(storeY - 25); + var form = $("#createSpaceLinkForm"); var label = $("#spaceLinkLabel").val(); var spaceName = $("#linkedSpace option:selected").text(); @@ -854,6 +863,7 @@ $("#createModuleLinkBtn").click(function(e) { e.preventDefault(); + $("#space").scrollTop(0); $('#errorAlert').hide(); if (storeX == undefined || storeY == undefined) { @@ -885,7 +895,7 @@ } $("#moduleLinkX").val(storeX); - $("#moduleLinkY").val(storeY); + $("#moduleLinkY").val(storeY - 25); var form = $("#createModuleLinkForm"); var formData = new FormData(form[0]); @@ -936,9 +946,10 @@ $('#errorAlert').show(); return; } + $("#space").scrollTop(0); var linkedModules = $("#moduleLinkIdEdit").val(); $("#moduleLinkXEdit").val(storeX); - $("#moduleLinkYEdit").val(storeY); + $("#moduleLinkYEdit").val(storeY - 25); var form = $("#editModuleLinkForm"); var formData = new FormData(form[0]); var moduleLinkInfo = editModuleLinkInfo(); @@ -984,9 +995,11 @@ $('#errorAlert').show(); return; } + $("#space").scrollTop(0); var linkedSpace = $("#spaceLinkIdEdit").val(); $("#spaceLinkXEdit").val(storeX); - $("#spaceLinkYEdit").val(storeY); + $("#spaceLinkYEdit").val(storeY - 25); + var form = $("#editSpaceLinkForm"); var formData = new FormData(form[0]); @@ -1028,6 +1041,7 @@ $("#editExternalLinkBtn").click(function(e) { e.preventDefault(); + $("#space").scrollTop(0); var linkId = $("#externalLinkIdEdit").val(); if (storeX == undefined || storeY == undefined) { $("#errorMsg").text("Please click on the image to specify where the new link should be located.") @@ -1036,7 +1050,7 @@ } var linkedSpace = $("#externalLinkIdEdit").val(); $("#externalLinkXEdit").val(storeX); - $("#externalLinkYEdit").val(storeY); + $("#externalLinkYEdit").val(storeY - 25); var form = $("#editExternalLinkForm"); var formData = new FormData(form[0]); var externalLinkInfo = editExternalLinkInfo(); @@ -1075,6 +1089,7 @@ $("#createExternalLinkBtn").click(function(e) { e.preventDefault(); + $("#space").scrollTop(0); var payload = {}; if (storeX == undefined || storeY == undefined) { @@ -1106,7 +1121,7 @@ return; } $("#externalLinkX").val(storeX); - $("#externalLinkY").val(storeY); + $("#externalLinkY").val(storeY - 25); var form = $("#createExternalLinkForm"); var formData = new FormData(form[0]); @@ -1295,42 +1310,51 @@ storeX = null; storeY = null; linkIcon = null; + $("#space").scrollTop(0); $("#link").remove(); - + $("#undefined").remove(); $("#space_label").remove(); $("#space").hide(); $("#createSpaceLinkAlert").hide(); $('#errorAlert').hide(); + $("#bgImage").off("click"); drawLinks(); }); $(".cancelModuleLinkBtn").click(function() { storeX = null; storeY = null; + $("#space").scrollTop(0); moduleLinkIcon=null; $("#link").remove(); + $("#undefined").remove(); $("#module_label").remove(); $("#space").hide(); $("#createModuleLinkAlert").hide(); $('#errorAlert').hide(); + $("#bgImage").off("click"); drawLinks(); }); $(".cancelExternalLinkBtn").click(function() { storeX = null; storeY = null; + $("#space").scrollTop(0); externalLinkIcon=null; $("#external-link").remove(); + $("#undefined").remove(); $("div#link").remove(); $("#external-arrow").remove(); $("#ext_label").remove(); $("#space").hide(); $("#createExternalLinkAlert").hide(); $('#errorAlert').hide(); + $("#bgImage").off("click"); drawLinks(); }); $("#cancelBgImgBtn").click(function() { + $("#space").scrollTop(0); drawLinks(); $("#file").val(''); $("#changeBgImgAlert").hide();