I'm using geofield and openlayers to collect point data, and when the node add form is displayed, the point button on the editing toolbar is enabled (active) upon initial load, but the problem is, the map does not accept a point (nor display a marker). If you click on another button (such as the pan button or if drawing path, the Path button) and then click back to the Point button, then a marker is displayed and the point is saved in the db.
I was looking in the file openlayers_behavior_geofield.js where the buttons are added to the map, and I was looking for a way to disable the button on first load. This way, the user would be forced to click on the button prior to editing. I think in the long run, it is better to have this button enabled on page load (or better yet, give the site builder the ability to choose the default button state), but in the short term, I was just trying to disable the button on load and force them to click something. Does someone have the proper OpenLayers api call to do this? I seem to be spinning my wheels on this.
This issue also appeared in 7.x-1.x-dev, and I upgraded to 7.x-2 to see if this problem was resolved. Doesn't seem to be resolved yet. I've also tested this on several browsers on Windows and Ubuntu and the are all doing the same thing. I've tried different themes, trying to isolate this issue, with no change.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | openlayers_behavior_geofield.js_.txt | 6.74 KB | rolf van de krol |
Comments
Comment #1
Brandonian commentedChanging component. Geofield Map is bundled map display, not input.
Comment #2
mbrakken commentedI'm also facing this problem. It's as though the display functionally loads with the drag tool enabled, but appears as though the point tool is enabled. I think if the default load was just on the dragger it would suffice because it would generate less confusion. I have no idea how to do that, though.
For what it's worth, when selecting the different tools, all buttons turn grey when the corresponding tool is in use except for the drag tool. I can't help but think there's a relation.
Comment #3
wemmies commentedI'm also running into this. As I have only the point enabled, I can't use the work arround. Seems to place a point when I hit the right mouse button.
Comment #4
tamago commentedI have the same problem. I just needed a simple location marker and got stuck at this point.
Thanks to the hints from wemmies and mbrakken I played around to get around of this very annoying bug.
What I can see:
I didn't have the time to look deeper into this, as I am quite new to OpenLayers and some first helpless debugging attempts led me into a hell of javascript-objects... and I can live with the workaround of deactivating the "Navigation" behaviour.
Hope this helps someone a little bit.
And ... thanks for this module. Basically I do like it.
Comment #5
acIssue confirmed here. Any thoughts on a fix?
Marking as major as when this interface is presented to a non technical user this is a roadblock so large they give up.
Comment #6
rolf van de krol commentedI had the same problem with 7.x-1.x and took some time to get it working again. I came up with attached openlayers_behavior_geofield.js. I'm not going to cook this solution into a real patch, because this is a really ugly solution, but it seems to be a working workaround.
Comment #7
wemmies commentedRolf,
unfortunately the js you posted doesn't do the trick for me.as tamago stated, turning of the mouse drag pan makes it work. Hope somenone can fix this.Fix did the trick, THANX. Forgot to clear my cache....
Comment #8
dpw commentedThanks for sharing Rolf. Does the trick for me too.
Comment #9
Brandonian commentedI've done some cleanup on our OL implementation, which should take care of the problem. Try it out and see what you think. Thanks, all.
2.x - http://drupalcode.org/project/geofield.git/commit/84822fd
1.x - http://drupalcode.org/project/geofield.git/commit/bf57f51
Comment #10
acHey Brandonian,
Thanks for the patch - I can't test against HEAD - any chance of a patch against 7.x-1.0?
I did manually patch against that but it took away the ability to pan and zoom as I assume I am probably missing big changes already committed to HEAD. I understand if its too hard to roll this against the 7.x-1.0 release.
Comment #11
Brandonian commentedAn update, as reported in #1546176: Geofield Openlayers Widget can't pan and zoom after upgrade, my bugfix from earlier in this thread caused some issues, so I've taken a different approach in fixing the problem.
The current solution that's been committed moves the default option for our behavior to be either the edit control or a generic navigation control (if you don't enable editing on your map for whatever reason). This isn't my preferred UX (having to select your draw tool each time initially), but until we get our implementation to work by default with a draw tool enabled, I think this is a fair compromise, and better UX than the map outright breaking.
I'm not 100% sure on why our original (pre this issue) fix was breaking, but it seems like the DrawControl js object wasn't receiving proper data for the map layer for some reason, possibly due to info not being available yet. A patch earlier in the thread attempted to solve this issue by adding a slight delay before activating the control. While others said that they had this working on their sites, I couldn't get it to work on my dev site, and it seems too hacky a solution long term for me anyway (no offense, @Rolf van de Krol :-) ).
While I'm keeping this issue marked as fixed, if anybody happens to get to a better solution for this, I'm definitely open to patches/alternate solutions.
1.x - http://drupalcode.org/project/geofield.git/commit/ebc5bc1
2.x - http://drupalcode.org/project/geofield.git/commit/ea5f97a
Comment #12
Michael Westhof commentedGetting the same as #10 ( no pan and zoom, no scale line) .
Tried on HEAD and 7.x-1.0
Firebug console shows:
TypeError: control[0] is undefined
Which I think it refers to line 168 after your commit.
control[0].activate();
Edit: Brandonian just posted a new commit, which I hadn't seen yet but is a workable solution for me.
Thx, Brandonian!
Comment #13
Brandonian commented@Michael Westhof, This issue is addressed in #11. I skimmed #10 earlier and missed the comment.