Commit d364a706 authored by wjf's avatar wjf

l

parent eb2f29c0
import {SHAPES} from '../../const'; import { SHAPES } from '../../const';
import {Point} from '../../math'; import { Point } from '../../math';
/** /**
* The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its
...@@ -40,6 +40,12 @@ export default class RoundedRectangle { ...@@ -40,6 +40,12 @@ export default class RoundedRectangle {
this.width = width; this.width = width;
this.height = height; 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; this.radius = radius;
......
import Container from "../display/Container"; import Container from "../display/Container";
import Graphics from "../graphics/Graphics"; import Graphics from "../graphics/Graphics";
import {MouseEvent} from "../events/MouseEvent"; import { MouseEvent } from "../events/MouseEvent";
import {Event} from "../events/Event"; import { Event } from "../events/Event";
// import Tween from "../../tweenSimple/Tween"; // import Tween from "../../tweenSimple/Tween";
...@@ -173,14 +173,20 @@ export class ScrollContainer extends Container { ...@@ -173,14 +173,20 @@ export class ScrollContainer extends Container {
s.maskObj.isUsedToMask = false; s.maskObj.isUsedToMask = false;
} }
s.maskObj.alpha = 0; s.maskObj.alpha = 0;
if(maxDistance !== undefined){ if (maxDistance !== undefined) {
//s.maxDistance = maxDistance; //s.maxDistance = maxDistance;
} }
s.updateViewRect(isVertical); 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_MOVE, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s); // s.addEventListener(MouseEvent.MOUSE_UP, s.onMouseEvent, s);
s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s); // s.addEventListener(MouseEvent.MOUSE_OUT, s.onMouseEvent, s);
s.addEventListener(Event.ENTER_FRAME, function () { s.addEventListener(Event.ENTER_FRAME, function () {
let view: any = s.viewPort; let view: any = s.viewPort;
if (s.autoScroll) return; if (s.autoScroll) return;
...@@ -253,7 +259,7 @@ export class ScrollContainer extends Container { ...@@ -253,7 +259,7 @@ export class ScrollContainer extends Container {
s.addEventListener(Event.RESIZE, this.updateViewRect, s); s.addEventListener(Event.RESIZE, this.updateViewRect, s);
} }
get maxDistance(){ get maxDistance() {
return this.viewPort.height; return this.viewPort.height;
} }
...@@ -272,7 +278,7 @@ export class ScrollContainer extends Container { ...@@ -272,7 +278,7 @@ 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();
if(isVertical !== undefined){ if (isVertical !== undefined) {
s.isVertical = isVertical; s.isVertical = isVertical;
} }
if (isVertical) { if (isVertical) {
...@@ -288,8 +294,7 @@ export class ScrollContainer extends Container { ...@@ -288,8 +294,7 @@ export class ScrollContainer extends Container {
let s = this; let s = this;
let view: any = s.viewPort; let view: any = s.viewPort;
// if (s.distance < s.maxDistance) { // if (s.distance < s.maxDistance) {
if (e.type == MouseEvent.MOUSE_MOVE) { if (e.type == MouseEvent.MOUSE_DOWN) {
if (s.isMouseDownState < 1) {
if (!s.isStop) { if (!s.isStop) {
s.isStop = true; s.isStop = true;
} }
...@@ -304,9 +309,8 @@ export class ScrollContainer extends Container { ...@@ -304,9 +309,8 @@ export class ScrollContainer extends Container {
} }
s.speed = 0; s.speed = 0;
s.isMouseDownState = 1; s.isMouseDownState = 1;
return;
} }
; else if (e.type == MouseEvent.MOUSE_MOVE) {
if (s.isMouseDownState == 1) { if (s.isMouseDownState == 1) {
s.dispatchEvent(Event.ON_SCROLL_START); 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