通过按钮去点击切换page怎么去判断是不是最后一页和第一页,有时间吗??
每次向前翻,遍历每一页的页码,等于0就是第一页,否则就不是
每次向后翻,遍历每一页的页码,等于“总页数-1”就是最后一页,否则就不是
我发现问题了,有时候手滑动翻页的,所以坐标没有更改
,怎么把手动滑动给关了
没太明白你意思,具体什么场景下使用
pageview可以通过手滑去翻页,能不能不手滑翻页关闭呢
下面放个禁止手滑动的节点
protected _unregisterEvent (): void {
this.node.off(NodeEventType.TOUCH_START, this._onTouchBegan, this, true);
this.node.off(NodeEventType.TOUCH_MOVE, this._onTouchMoved, this, true);
this.node.off(NodeEventType.TOUCH_END, this._onTouchEnded, this, true);
this.node.off(NodeEventType.TOUCH_CANCEL, this._onTouchCancelled, this, true);
this.node.off(NodeEventType.MOUSE_WHEEL, this._onMouseWheel, this, true);
this.node.off(XrUIPressEventType.XRUI_HOVER_ENTERED, this._xrHoverEnter, this);
this.node.off(XrUIPressEventType.XRUI_HOVER_EXITED, this._xrHoverExit, this);
input.off(Input.EventType.HANDLE_INPUT, this._dispatchEventHandleInput, this);
input.off(Input.EventType.GAMEPAD_INPUT, this._dispatchEventHandleInput, this);
}
PageView是继承ScrollView的,这个是ScrollView的触摸事件,你不需要的自己移除掉就好了