Prevent dragging of button group if buttons are not wider than maxWidth.
This commit is contained in:
Vendored
+31
-25
@@ -3378,18 +3378,21 @@
|
||||
* @param {*} event
|
||||
*/
|
||||
onStart(event) {
|
||||
this.__dragging = true;
|
||||
|
||||
this.capture(event);
|
||||
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||
this.__dragging = true;
|
||||
|
||||
this.__delta = {
|
||||
x: this.container.position.x - event.data.global.x,
|
||||
y: this.container.position.y - event.data.global.y
|
||||
};
|
||||
this.capture(event);
|
||||
|
||||
TweenLite.killTweensOf(this.container.position, { x: true, y: true });
|
||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
||||
ThrowPropsPlugin.track(this.container.position, 'x,y');
|
||||
this.__delta = {
|
||||
x: this.container.position.x - event.data.global.x,
|
||||
y: this.container.position.y - event.data.global.y
|
||||
};
|
||||
|
||||
TweenLite.killTweensOf(this.container.position, { x: true, y: true });
|
||||
if (typeof ThrowPropsPlugin != 'undefined') {
|
||||
ThrowPropsPlugin.track(this.container.position, 'x,y');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3484,25 +3487,28 @@
|
||||
* @param {*} event
|
||||
*/
|
||||
onScroll(event) {
|
||||
this.capture(event);
|
||||
|
||||
if (this.opts.orientation === 'horizontal') {
|
||||
this.container.position.x -= event.deltaX;
|
||||
if (this.container.position.x > 0) {
|
||||
this.container.position.x = 0;
|
||||
} else if (this.container.position.x + this.__initWidth < this.opts.maxWidth) {
|
||||
this.container.position.x = this.opts.maxWidth - this.__initWidth;
|
||||
}
|
||||
} else {
|
||||
this.container.position.y -= event.deltaY;
|
||||
if (this.container.position.y > 0) {
|
||||
this.container.position.y = 0;
|
||||
} else if (this.container.position.y + this.container.height < this.opts.maxHeight) {
|
||||
this.container.position.y = this.opts.maxHeight - this.container.height;
|
||||
if ((this.opts.maxWidth != null && this.__initWidth > this.opts.maxWidth) || (this.opts.maxHeight != null && this.__initHeight > this.opts.maxHeight)) {
|
||||
this.capture(event);
|
||||
|
||||
if (this.opts.orientation === 'horizontal') {
|
||||
this.container.position.x -= event.deltaX;
|
||||
if (this.container.position.x > 0) {
|
||||
this.container.position.x = 0;
|
||||
} else if (this.container.position.x + this.__initWidth < this.opts.maxWidth) {
|
||||
this.container.position.x = this.opts.maxWidth - this.__initWidth;
|
||||
}
|
||||
} else {
|
||||
this.container.position.y -= event.deltaY;
|
||||
if (this.container.position.y > 0) {
|
||||
this.container.position.y = 0;
|
||||
} else if (this.container.position.y + this.container.height < this.opts.maxHeight) {
|
||||
this.container.position.y = this.opts.maxHeight - this.container.height;
|
||||
}
|
||||
}
|
||||
|
||||
this.stack();
|
||||
}
|
||||
|
||||
this.stack();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user