Commit d364a706 authored by wjf's avatar wjf

l

parent eb2f29c0
import {SHAPES} from '../../const';
import {Point} from '../../math';
import { SHAPES } from '../../const';
import { Point } from '../../math';
/**
* The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its
......@@ -40,6 +40,12 @@ export default class RoundedRectangle {
this.width = width;
this.height = height;
//计算最大圆角
let max = (width < height ? width : height) / 2;
//小于0取反
radius = radius < 0 ? -radius : radius;
//大于max取max
radius = radius > max ? max : radius;
this.radius = radius;
......
import Container from "../display/Container";
import Graphics from "../graphics/Graphics";
import {MouseEvent} from "../events/MouseEvent";
import {Event} from "../events/Event";
import { MouseEvent } from "../events/MouseEvent";
import { Event } from "../events/Event";
// import Tween from "../../tweenSimple/Tween";
......@@ -173,14 +173,20 @@ export class ScrollContainer extends Container {
s.maskObj.isUsedToMask = false;
}
s.maskObj.alpha = 0;
if(maxDistance !== undefined){
if (maxDistance !== undefined) {
//s.maxDistance = maxDistance;
}
s.updateViewRect(isVertical);
// s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent.bind(s));
s.addEventListener(Event.ADDED_TO_STAGE, function (e: Event) {
s.stage.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
})
s.addEventListener(Event.REMOVED_FROM_STAGE, function (e: Event) {
s.stage.removeEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
});
s.addEventListener(MouseEvent.MOUSE_DOWN, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_MOVE, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
// s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
// s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
s.addEventListener(Event.ENTER_FRAME, function () {
let view: any = s.viewPort;
if (s.autoScroll) return;
......@@ -253,7 +259,7 @@ export class ScrollContainer extends Container {
s.addEventListener(Event.RESIZE, this.updateViewRect, s);
}
get maxDistance(){
get maxDistance() {
return this.viewPort.height;
}
......@@ -272,7 +278,7 @@ export class ScrollContainer extends Container {
s.maskObj.beginFill("#000000");
s.maskObj.drawRect(0, 0, s.width, s.height);
s.maskObj.endFill();
if(isVertical !== undefined){
if (isVertical !== undefined) {
s.isVertical = isVertical;
}
if (isVertical) {
......@@ -288,25 +294,23 @@ export class ScrollContainer extends Container {
let s = this;
let view: any = s.viewPort;
// if (s.distance < s.maxDistance) {
if (e.type == MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState < 1) {
if (!s.isStop) {
s.isStop = true;
}
if (s.autoScroll) {
s.autoScroll = false;
// Tween.kill(s._tweenId);
}
if (s.isVertical) {
s.lastValue = e.localY;
} else {
s.lastValue = e.localX;
}
s.speed = 0;
s.isMouseDownState = 1;
return;
if (e.type == MouseEvent.MOUSE_DOWN) {
if (!s.isStop) {
s.isStop = true;
}
if (s.autoScroll) {
s.autoScroll = false;
// Tween.kill(s._tweenId);
}
if (s.isVertical) {
s.lastValue = e.localY;
} else {
s.lastValue = e.localX;
}
;
s.speed = 0;
s.isMouseDownState = 1;
}
else if (e.type == MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState == 1) {
s.dispatchEvent(Event.ON_SCROLL_START);
}
......
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