dojo.connect(map,"onClick",function(evt){ var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,10); var deferred = featureLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint); map.infoWindow.resize(200,100); map.centerAt(evt.mapPoint); });
Hi Shreyas,Yes, it is a workaround to recenter the map on each click - but we would like to have the default behavior where the popup is placed according to the map window. Any chance you'll fix this bug? This seems to work correctly with the standard InfoWindow, the problem occurs in esri.dijit.Popup.Bjorn
if (roomToTheRight && roomAbove) { horAnchor = "Left"; verAnchor = "bottom"; } else if (roomToTheRight && roomBelow) { horAnchor = "Left"; verAnchor = "top"; } else if (roomToTheLeft && roomBelow) { horAnchor = "Right"; verAnchor = "top"; } else if (roomToTheLeft && roomAbove) { horAnchor = "Right"; verAnchor = "bottom"; } else { // No room in any direcion, choose anchor that gives most room var horCoverages = []; horCoverages.push({ "anchor": "", "overflow": Math.max(0, (contentBox.w / 2) - (absoluteX - left)) + Math.max(0, (contentBox.w / 2) - (right - absoluteX + 1)) }); horCoverages.push({ "anchor": "Right", "overflow": Math.max(0, contentBox.w - (absoluteX - left)) }); horCoverages.push({ "anchor": "Left", "overflow": Math.max(0, contentBox.w - (right - absoluteX + 1)) }); var verCoverages = []; verCoverages.push({ "anchor": "", "overflow": Math.max(0, (heightNeeded / 2) - (absoluteY - top)) + Math.max(0, (heightNeeded / 2) - (bottom - absoluteY + 1)) }); verCoverages.push({ "anchor": "bottom", "overflow": Math.max(0, heightNeeded - (absoluteY - top)) }); verCoverages.push({ "anchor": "top", "overflow": Math.max(0, heightNeeded - (bottom - absoluteY + 1)) }); var sortFunction = function (a, b) { return a.overflow > b.overflow; }; horCoverages.sort(sortFunction); verCoverages.sort(sortFunction); horAnchor = horCoverages[0].anchor; verAnchor = verCoverages[0].anchor; console.log("There's no room for the popup, chose most optimal anchoring " + verAnchor + horAnchor + "..."); }
After 5 years now, this problem is still present and your workaround does not work with the version 3.22
I have trouble understanding your solution Is it possible to have the full code of your _setPosition function?
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.