googlearchive / core-splitter

A split bar and dragging on it will resize the sibling element
10 stars 12 forks source link

Disble selection #3

Closed warnerandy closed 10 years ago

warnerandy commented 10 years ago

Having text become selected while moving the splitter is unwanted behavior. So lets disable text selection while the splitter is moving.

warnerandy commented 10 years ago

cool, i'll make the changes

warnerandy commented 10 years ago

@frankiefu i've made your changes let me know if there is anything else i need to do

warnerandy commented 10 years ago

@frankiefu fixed the tabbing and the missed camelCasing

frankiefu commented 10 years ago

lgtm

arv commented 10 years ago

FWIW, you can achieve the same with preventDefault. See https://chromium.googlesource.com/chromium/src/+/master/ui/webui/resources/js/cr/ui/splitter.js#138

sjmiles commented 10 years ago

Sounds like this control should be built into the tracking gesture.

arv commented 10 years ago

@azakus The preventDefault needs to be done in mousedown. Calling preventDefault in trackstart did not work. I'll have to look into how trackstart is implemented.

arv commented 10 years ago

FWIW, https://github.com/Polymer/core-splitter/pull/4

dfreedm commented 10 years ago

@arv I imagine that trackstart is probably too late, as it is sent asynchronously, and only after a hysteresis threshold.

frankiefu commented 10 years ago

down doesn't work too. e.g.

on-down="{{preventSelection}}"
...
preventSelection: function(e) {
  e.preventDefault();
}
arv commented 10 years ago

@frankiefu You need to use on-mousedown. See #4. I manually tested it.

arv commented 10 years ago

@azakus Maybe we should move this into PointerGestures repo. preventDefault in down should work, shouldn't it?

frankiefu commented 10 years ago

Thanks @arv for the insight. Also polymer now uses polymer-gestures instead of PointerGestures. I have filed couple issues on polymer-gestures regarding preventDefault in down doesn't work and have disable selection built into tracking gesture: https://github.com/Polymer/polymer-gestures/issues/20 https://github.com/Polymer/polymer-gestures/issues/21