Make selection scroll optional

It's not essential but rather causes several problems.
This commit is contained in:
Hyunje Alex Jun 2015-10-03 21:33:52 +09:00
parent 002034fd54
commit 17e5f67519
4 changed files with 21 additions and 11 deletions

View File

@ -312,6 +312,10 @@ The number of pixels the content height can surpass the container height without
When set to false, when clicking on a rail, the click event will be allowed to propagate. When set to false, when clicking on a rail, the click event will be allowed to propagate.
**Default: true** **Default: true**
### useSelectionScroll
When set to true, you can scroll the container by selecting text and move the cursor.
**Default: false**
## Events ## Events
perfect-scrollbar dispatches custom events. perfect-scrollbar dispatches custom events.

View File

@ -32,7 +32,9 @@
<script> <script>
var $ = document.querySelector.bind(document); var $ = document.querySelector.bind(document);
window.onload = function () { window.onload = function () {
Ps.initialize($('#description')); Ps.initialize($('#description'), {
useSelectionScroll: true
});
}; };
$('#redraw').addEventListener('click', function () { $('#redraw').addEventListener('click', function () {
var oldHtml = $('#description').innerHTML; var oldHtml = $('#description').innerHTML;

View File

@ -4,16 +4,17 @@
'use strict'; 'use strict';
module.exports = { module.exports = {
wheelSpeed: 1,
wheelPropagation: false,
swipePropagation: true,
minScrollbarLength: null,
maxScrollbarLength: null, maxScrollbarLength: null,
useBothWheelAxes: false, minScrollbarLength: null,
useKeyboard: true,
suppressScrollX: false,
suppressScrollY: false,
scrollXMarginOffset: 0, scrollXMarginOffset: 0,
scrollYMarginOffset: 0, scrollYMarginOffset: 0,
stopPropagationOnClick: true stopPropagationOnClick: true,
suppressScrollX: false,
suppressScrollY: false,
swipePropagation: true,
useBothWheelAxes: false,
useKeyboard: true,
useSelectionScroll: false,
wheelPropagation: false,
wheelSpeed: 1
}; };

View File

@ -31,7 +31,10 @@ module.exports = function (element, userSettings) {
dragScrollbarHandler(element); dragScrollbarHandler(element);
mouseWheelHandler(element); mouseWheelHandler(element);
nativeScrollHandler(element); nativeScrollHandler(element);
if (i.settings.useSelectionScroll) {
selectionHandler(element); selectionHandler(element);
}
if (h.env.supportsTouch || h.env.supportsIePointer) { if (h.env.supportsTouch || h.env.supportsIePointer) {
touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer); touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer);