Commit 864665b3 authored by rockyl's avatar rockyl

修复遮罩嵌套问题

修改滚动方向
parent 620d3045
...@@ -11089,6 +11089,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -11089,6 +11089,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
_this.maxSpeed = 100; _this.maxSpeed = 100;
_this.fSpeed = 20; _this.fSpeed = 20;
_this.paramXY = "y"; _this.paramXY = "y";
_this.paramSize = "height";
_this.stopTimes = -1; _this.stopTimes = -1;
_this.isMouseDownState = 0; _this.isMouseDownState = 0;
_this.autoScroll = false; _this.autoScroll = false;
...@@ -11189,7 +11190,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -11189,7 +11190,7 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
} }
Object.defineProperty(ScrollContainer.prototype, "maxDistance", { Object.defineProperty(ScrollContainer.prototype, "maxDistance", {
get: function () { get: function () {
return this.viewPort.height; return this.viewPort[this.paramSize];
}, },
enumerable: true, enumerable: true,
configurable: true configurable: true
...@@ -11200,25 +11201,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate: ...@@ -11200,25 +11201,31 @@ var tslib = {__extends: __extends,__assign: __assign,__rest: __rest,__decorate:
}, },
set: function (value) { set: function (value) {
this._direction = value; this._direction = value;
this.updateDirection();
},
enumerable: true,
configurable: true
});
ScrollContainer.prototype.updateDirection = function () {
var s = this; var s = this;
if (value === exports.SCROLL_DIRECTION.VERTICAL) { if (this._direction === exports.SCROLL_DIRECTION.VERTICAL) {
s.distance = s.height; s.distance = s.height;
s.paramXY = "y"; s.paramXY = "y";
s.paramSize = 'height';
} }
else { else {
s.distance = s.width; s.distance = s.width;
s.paramXY = "x"; s.paramXY = "x";
s.paramSize = 'width';
} }
}, };
enumerable: true,
configurable: true
});
ScrollContainer.prototype.updateViewRect = function () { ScrollContainer.prototype.updateViewRect = function () {
var s = this; var s = this;
s.maskObj.clear(); s.maskObj.clear();
s.maskObj.beginFill("#000000"); s.maskObj.beginFill("#000000");
s.maskObj.drawRect(0, 0, s.width, s.height); s.maskObj.drawRect(0, 0, s.width, s.height);
s.maskObj.endFill(); s.maskObj.endFill();
this.updateDirection();
}; };
ScrollContainer.prototype.onMouseEvent = function (e) { ScrollContainer.prototype.onMouseEvent = function (e) {
var s = this; var s = this;
......
This diff is collapsed.
...@@ -132,6 +132,7 @@ export class ScrollContainer extends Container { ...@@ -132,6 +132,7 @@ export class ScrollContainer extends Container {
*/ */
public fSpeed: number = 20; public fSpeed: number = 20;
protected paramXY: string = "y"; protected paramXY: string = "y";
protected paramSize: string = "height";
private stopTimes: number = -1; private stopTimes: number = -1;
private isMouseDownState: number = 0; private isMouseDownState: number = 0;
/** /**
...@@ -260,7 +261,7 @@ export class ScrollContainer extends Container { ...@@ -260,7 +261,7 @@ export class ScrollContainer extends Container {
} }
get maxDistance() { get maxDistance() {
return this.viewPort.height; return this.viewPort[this.paramSize];
} }
get direction(): SCROLL_DIRECTION { get direction(): SCROLL_DIRECTION {
...@@ -270,13 +271,19 @@ export class ScrollContainer extends Container { ...@@ -270,13 +271,19 @@ export class ScrollContainer extends Container {
set direction(value: SCROLL_DIRECTION) { set direction(value: SCROLL_DIRECTION) {
this._direction = value; this._direction = value;
this.updateDirection();
}
protected updateDirection(){
let s = this; let s = this;
if (value === SCROLL_DIRECTION.VERTICAL) { if (this._direction === SCROLL_DIRECTION.VERTICAL) {
s.distance = s.height; s.distance = s.height;
s.paramXY = "y"; s.paramXY = "y";
s.paramSize = 'height';
} else { } else {
s.distance = s.width; s.distance = s.width;
s.paramXY = "x"; s.paramXY = "x";
s.paramSize = 'width';
} }
} }
...@@ -292,6 +299,8 @@ export class ScrollContainer extends Container { ...@@ -292,6 +299,8 @@ export class ScrollContainer extends Container {
s.maskObj.beginFill("#000000"); s.maskObj.beginFill("#000000");
s.maskObj.drawRect(0, 0, s.width, s.height); s.maskObj.drawRect(0, 0, s.width, s.height);
s.maskObj.endFill(); s.maskObj.endFill();
this.updateDirection();
} }
private onMouseEvent(e: MouseEvent): void { private onMouseEvent(e: MouseEvent): void {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment