Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyline fix #661

Merged
merged 2 commits into from
Jan 2, 2017
Merged

Polyline fix #661

merged 2 commits into from
Jan 2, 2017

Conversation

ddproxy
Copy link
Member

@ddproxy ddproxy commented Dec 18, 2016

Polyline fixes squashed from @z0d14c's branch

Thomas Grice and others added 2 commits December 18, 2016 16:12
# This is the 1st commit message:

checking distance to last point
fixes; touch event still appears to be firing twice on IE
change gitignore so we can deploy git repo
add touch blocker
block touch when touch has already begun
touch events and log
browser.touch typo
dont show tooltip text for touch
move browser touch check to disable showlength
try timeout approach
debugging intersections
try different distance method
alternate method of distance calculation
another approach to distance
function for approaching close distance
lower threshold for finishing shape and log
prevent L.browser unbinding issue

# This is the commit message #2:

remove conditional application of event handlers and onMouseMove call from onTouch
@ddproxy ddproxy added the bug label Dec 18, 2016
@ddproxy ddproxy self-assigned this Dec 18, 2016
@ddproxy ddproxy mentioned this pull request Dec 18, 2016
@ddproxy
Copy link
Member Author

ddproxy commented Dec 18, 2016

Bugs:

  • When closing a polygon, the polylines can still cross, but still an improvement
  • Using chrome device toolbar (ipad mode) the touch events will fire twice and not allow a polyline to be continued (so it's a segment)

@ddproxy
Copy link
Member Author

ddproxy commented Dec 18, 2016

@z0d14c - If we can get the second bug resolved (and I don't find any other showstoppers) I can merge this PR and close the previous one.

@z0d14c
Copy link

z0d14c commented Dec 19, 2016

@ddproxy kk ill be looking into this this week

@ddproxy ddproxy merged commit e92eeab into master Jan 2, 2017
@ddproxy ddproxy deployed to github-pages January 2, 2017 23:06 Active
@z0d14c
Copy link

z0d14c commented Jan 3, 2017

I havent got a chance to look at this due to the holidays being crazier than expected. I'll be freeing up in the latter half of this week, though, hopefully.

@ddproxy
Copy link
Member Author

ddproxy commented Jan 3, 2017

@z0d14c It's fine, needed roll out what fixes are available now. I'll be back on duty soon too.

@formigarafa
Copy link

formigarafa commented Jan 27, 2017

hello there,

I have found a workaround to draw polylines on touch devices. I just delayed the addition of the finish handler on the last marker.

var originalPolylineClass = L.Draw.Polyline;
L.Draw.Polyline = originalPolylineClass.extend({
  _updateFinishHandler: function () {
    var markerCount = this._markers.length;
    // The last marker should have a click handler to close the polyline
    if (markerCount > 1) {
      var lastMarker = this._markers[markerCount - 1];
      setTimeout(function() {
        lastMarker.on('click', this._finishShape, this);
      }.bind(this), 50);
    }

    // Remove the old marker click handler (as only the last point should close the polyline)
    if (markerCount > 2) {
      this._markers[markerCount - 2].off('click', this._finishShape, this);
    }
  },
});

I hope this helps. Here it is working like a charm. BTW, great work here, thanks.

@ddproxy ddproxy deleted the polyline-fix branch July 3, 2017 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants