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

Option to select area with touchscreen #10

Closed
serako opened this issue May 17, 2019 · 3 comments
Closed

Option to select area with touchscreen #10

serako opened this issue May 17, 2019 · 3 comments

Comments

@serako
Copy link

serako commented May 17, 2019

I think you can have an option if we prefer have elevation zoom aera or indicator if we have a touch screen. because with touch screen it's not nice for moving the indicator!

for use with prefer indicator (i not implemented a condition with option!)
line 134 now 434 (but i don't try with our last modif)

    if (L.Browser.touch) {
      background (new focusrect?)
        .on("touchmove", this._mousemoveHandler.bind(this));
    //    .on("touchmove.drag", this._dragHandler.bind(this))
    //    .on("touchstart.drag", this._dragStartHandler.bind(this))
    //    .on("touchstart.focus", this._mousemoveHandler.bind(this));
    //  L.DomEvent.on(this._container, 'touchend', this._dragEndHandler, this);
    }
@Raruto
Copy link
Owner

Raruto commented May 18, 2019

from the original library i have found this (already pending) pull request: MrMufflon/Leaflet.Elevation#73 (it could it be related to this?)
otherwise, could you try to provide a more detailed example on how it could be solved?

@serako
Copy link
Author

serako commented May 20, 2019

I propose you modify on your last commit :
I do a just a little test, and i think it's OK. I test with firefox on simulate Samsung Galaxy S9

on line 37
screenTouchAction: 'selectArea', // possible value 'moveIndicator' and 'selectArea'

on line 430 (just add the test in "if (L.Browser.mobile) {" and add .on("touchmove", this._mousemoveHandler.bind(this));

  _appendFocusRect: function(g) {
    var focusRect = this._focusRect = g.append("rect")
      .attr("width", this._width())
      .attr("height", this._height())
      .style("fill", "none")
      .style("stroke", "none")
      .style("pointer-events", "all");

    if (L.Browser.mobile) {
      if (this.options.screenTouchAction == 'selectArea') {
        focusRect
          .on("touchmove.drag", this._dragHandler.bind(this))
          .on("touchstart.drag", this._dragStartHandler.bind(this))
          .on("touchstart.focus", this._mousemoveHandler.bind(this));
        L.DomEvent.on(this._container, 'touchend', this._dragEndHandler, this);
      } else {
        focusRect
          .on("touchmove", this._mousemoveHandler.bind(this));
      }
    }

    focusRect
      .on("mousemove.drag", this._dragHandler.bind(this))
      .on("mousedown.drag", this._dragStartHandler.bind(this))
      .on("mousemove.focus", this._mousemoveHandler.bind(this))
      .on("mouseout.focus", this._mouseoutHandler.bind(this));
    L.DomEvent.on(this._container, 'mouseup', this._dragEndHandler, this);
  },

@Raruto
Copy link
Owner

Raruto commented May 20, 2019

in version 0.2.6 i've introduced a "enable/disable" dragging mechanism (for mobile it is disabled by default), is it ok?

@Raruto Raruto closed this as completed May 28, 2019
@Raruto Raruto changed the title select aera whith touch screen Option to select area with touchscreen Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants