Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fyge_for_tb
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
fyge_for_tb
Commits
12622652
Commit
12622652
authored
Feb 08, 2022
by
wangjianfeng.yz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0.57
parent
abc1ac69
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
288 additions
and
298 deletions
+288
-298
FYGE.d.ts
build/FYGE.d.ts
+74
-87
fyge.esm.js
build/fyge.esm.js
+2
-2
fyge.esm.js.map
build/fyge.esm.js.map
+1
-1
fyge.min.js
build/fyge.min.js
+2
-2
fyge.min.js.map
build/fyge.min.js.map
+1
-1
types.d.ts
build/types.d.ts
+74
-87
pef.html
examples/pef.html
+1
-0
package.json
package.json
+1
-1
record.txt
record.txt
+6
-0
HashObject.ts
src/2d/HashObject.ts
+2
-5
const.ts
src/2d/const.ts
+1
-1
DisplayObject.ts
src/2d/display/DisplayObject.ts
+1
-1
FloatDisplay.ts
src/2d/display/FloatDisplay.ts
+30
-27
Stage.ts
src/2d/display/Stage.ts
+63
-42
Event.ts
src/2d/events/Event.ts
+4
-14
EventDispatcher.ts
src/2d/events/EventDispatcher.ts
+6
-6
MouseEvent.ts
src/2d/events/MouseEvent.ts
+15
-15
Shape.ts
src/2d/graphics/Shape.ts
+2
-2
TextField.ts
src/2d/text/TextField.ts
+2
-4
No files found.
build/FYGE.d.ts
View file @
12622652
This diff is collapsed.
Click to expand it.
build/fyge.esm.js
View file @
12622652
This diff is collapsed.
Click to expand it.
build/fyge.esm.js.map
View file @
12622652
This diff is collapsed.
Click to expand it.
build/fyge.min.js
View file @
12622652
This diff is collapsed.
Click to expand it.
build/fyge.min.js.map
View file @
12622652
This diff is collapsed.
Click to expand it.
build/types.d.ts
View file @
12622652
This diff is collapsed.
Click to expand it.
examples/pef.html
View file @
12622652
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
document
.
body
.
clientHeight
,
document
.
body
.
clientHeight
,
FYGE
.
RENDERER_TYPE
.
WEBGL
,
FYGE
.
RENDERER_TYPE
.
WEBGL
,
);
);
console
.
log
(
stage
)
//监听窗口缩放,按需,一般移动端的不需要
//监听窗口缩放,按需,一般移动端的不需要
// window.addEventListener('resize', () => { stage.resize() });
// window.addEventListener('resize', () => { stage.resize() });
//鼠标事件
//鼠标事件
...
...
package.json
View file @
12622652
{
{
"name"
:
"fyge"
,
"name"
:
"fyge"
,
"version"
:
"2.0.5
6
"
,
"version"
:
"2.0.5
7
"
,
"description"
:
"canvas渲染引擎"
,
"description"
:
"canvas渲染引擎"
,
"main"
:
"./build/fyge.min.js"
,
"main"
:
"./build/fyge.min.js"
,
"module"
:
"./build/fyge.esm.js"
,
"module"
:
"./build/fyge.esm.js"
,
...
...
record.txt
View file @
12622652
...
@@ -550,6 +550,12 @@
...
@@ -550,6 +550,12 @@
TextField的updateText方法内多行文本内,对于未设置文本宽度textWidth,不执行下面的测量,用else连接,realLines单独处理
TextField的updateText方法内多行文本内,对于未设置文本宽度textWidth,不执行下面的测量,用else连接,realLines单独处理
ScrollPage的scrollTo方法内缓动前增加执行移除先前缓动
ScrollPage的scrollTo方法内缓动前增加执行移除先前缓动
2.0.57 FloatDisplay新增addHtmlElement方法,用于处理html的插入
Stage新增autoSteering和scaleMode的get、set方法
Event删除静态属性CALL_FRAME
其他的都是注释的修改
...
...
src/2d/HashObject.ts
View file @
12622652
...
@@ -12,22 +12,19 @@ export abstract class HashObject {
...
@@ -12,22 +12,19 @@ export abstract class HashObject {
}
}
/**
/**
*
每一个对象都会有一个唯一的id码。
*
实例唯一id
* @property instanceId
* @property instanceId
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @return {number}
* @return {number}
* @readonly
* @readonly
* @example
* //获取 对象唯一码
* console.log(this.instanceId);
*/
*/
public
get
instanceId
():
number
{
public
get
instanceId
():
number
{
return
this
.
_instanceId
;
return
this
.
_instanceId
;
}
}
/**
/**
*
每一个类都有一个实例类型字符串,通过这个字符串,你能知道这个实例是从哪个类实例而来
*
实例类型
* @property instanceType
* @property instanceType
* @since 1.0.0
* @since 1.0.0
* @public
* @public
...
...
src/2d/const.ts
View file @
12622652
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* @name VERSION
* @name VERSION
* @type {string}
* @type {string}
*/
*/
export
const
VERSION
=
"2.0.5
6
"
;
export
const
VERSION
=
"2.0.5
7
"
;
/**
/**
...
...
src/2d/display/DisplayObject.ts
View file @
12622652
...
@@ -296,7 +296,7 @@ export class DisplayObject extends EventDispatcher {
...
@@ -296,7 +296,7 @@ export class DisplayObject extends EventDispatcher {
}
}
/**
/**
* 将本地坐标转换到全局坐标值
* 将本地坐标转换到全局坐标值
(stage存在时返回stage上的坐标,不存在为画布全局坐标)
* @method localToGlobal
* @method localToGlobal
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
...
src/2d/display/FloatDisplay.ts
View file @
12622652
...
@@ -2,11 +2,7 @@ import { Event } from "../events/Event";
...
@@ -2,11 +2,7 @@ import { Event } from "../events/Event";
import
{
DisplayObject
}
from
"./DisplayObject"
;
import
{
DisplayObject
}
from
"./DisplayObject"
;
// import { devicePixelRatio } from "../const";
// import { devicePixelRatio } from "../const";
/**
/**
* 此类对于需要在canvas上放置html其他类型元素的时候非常有用<br/>
* canvas上的html标签浮层
* 比如有时候我们需要放置一个注册,登录或者其他的内容.这些内容包含了输入框<br/>
* 或者下拉框什么的,无法在canvas里实现,但这些元素又跟canvas里面的元素<br/>
* 位置,大小,缩放对应.就相当于是一个显示对象一样。可以随意设置他的<br/>
* 属性,那么将你的html元素通过此类封装成显示对象再合适不过了
* 不能用于容器
* 不能用于容器
* 注意canvas所在标签和自身htmlElement样式position设置为absolute
* 注意canvas所在标签和自身htmlElement样式position设置为absolute
* @class FloatDisplay
* @class FloatDisplay
...
@@ -16,7 +12,7 @@ import { DisplayObject } from "./DisplayObject";
...
@@ -16,7 +12,7 @@ import { DisplayObject } from "./DisplayObject";
*/
*/
export
class
FloatDisplay
extends
DisplayObject
{
export
class
FloatDisplay
extends
DisplayObject
{
/**
/**
*
需要封装起来的html元素的引用。你可以通过这个引用来调用或设置此元素自身的属性方法和事件,甚至是样式
*
包装的html元素
* @property htmlElement
* @property htmlElement
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -42,13 +38,6 @@ export class FloatDisplay extends DisplayObject {
...
@@ -42,13 +38,6 @@ export class FloatDisplay extends DisplayObject {
* @since 1.0.0
* @since 1.0.0
* @public
* @public
* @example
* @example
* var floatDisplay = new FloatDisplay();
* floatDisplay.init(document.getElementById('aaa'));
* s.addChild(floatDisplay);
*
* <p><a href="" target="_blank">测试链接</a></p>
*
* @example
* //创建悬浮的html元素
* //创建悬浮的html元素
* var section = document.createElement('section');
* var section = document.createElement('section');
* section.id = "rule";
* section.id = "rule";
...
@@ -86,13 +75,14 @@ export class FloatDisplay extends DisplayObject {
...
@@ -86,13 +75,14 @@ export class FloatDisplay extends DisplayObject {
let
style
=
s
.
htmlElement
.
style
;
let
style
=
s
.
htmlElement
.
style
;
if
(
!
s
.
_isAdded
)
{
if
(
!
s
.
_isAdded
)
{
s
.
_isAdded
=
true
;
s
.
_isAdded
=
true
;
if
(
s
.
stage
[
"rootDiv"
])
{
// if (s.stage["rootDiv"]) {
s
.
stage
[
"rootDiv"
].
insertBefore
(
s
.
htmlElement
,
s
.
stage
[
"rootDiv"
].
childNodes
[
0
]);
// s.stage["rootDiv"].insertBefore(s.htmlElement, s.stage["rootDiv"].childNodes[0]);
}
// }
//没有div直接加在body里吧
// //没有div直接加在body里吧
else
{
// else {
document
.
body
.
appendChild
(
s
.
htmlElement
)
// document.body.appendChild(s.htmlElement)
}
// }
s
.
addHtmlElement
()
}
else
{
}
else
{
if
(
s
.
htmlElement
&&
s
.
visible
)
{
if
(
s
.
htmlElement
&&
s
.
visible
)
{
style
.
display
=
"block"
;
//"inline-block"
style
.
display
=
"block"
;
//"inline-block"
...
@@ -146,13 +136,14 @@ export class FloatDisplay extends DisplayObject {
...
@@ -146,13 +136,14 @@ export class FloatDisplay extends DisplayObject {
//如果原先在舞台上,加入,是否显示下一帧吧
//如果原先在舞台上,加入,是否显示下一帧吧
if
(
s
.
stage
)
{
if
(
s
.
stage
)
{
s
.
_isAdded
=
true
;
s
.
_isAdded
=
true
;
if
(
s
.
stage
[
"rootDiv"
])
{
// if (s.stage["rootDiv"]) {
s
.
stage
[
"rootDiv"
].
insertBefore
(
s
.
htmlElement
,
s
.
stage
[
"rootDiv"
].
childNodes
[
0
]);
// s.stage["rootDiv"].insertBefore(s.htmlElement, s.stage["rootDiv"].childNodes[0]);
}
// }
//没有div直接加在body里吧
// //没有div直接加在body里吧
else
{
// else {
document
.
body
.
appendChild
(
s
.
htmlElement
)
// document.body.appendChild(s.htmlElement)
}
// }
s
.
addHtmlElement
()
}
}
}
}
...
@@ -243,6 +234,18 @@ export class FloatDisplay extends DisplayObject {
...
@@ -243,6 +234,18 @@ export class FloatDisplay extends DisplayObject {
// this.updateStyle();
// this.updateStyle();
// }
// }
private
addHtmlElement
()
{
const
{
stage
,
htmlElement
}
=
this
;
if
(
!
stage
||
!
htmlElement
)
return
;
var
divParent
=
this
.
stage
[
"canvas"
].
parentNode
;
if
(
divParent
)
{
divParent
.
insertBefore
(
htmlElement
,
divParent
.
childNodes
[
0
])
}
else
{
//没有div直接加在body里
document
.
body
.
appendChild
(
htmlElement
)
}
}
public
destroy
():
void
{
public
destroy
():
void
{
super
.
destroy
();
super
.
destroy
();
this
.
removeHtmlElement
();
this
.
removeHtmlElement
();
...
...
src/2d/display/Stage.ts
View file @
12622652
...
@@ -17,86 +17,79 @@ import { getEnv, getOsType, isWebGLSupported } from "../utils";
...
@@ -17,86 +17,79 @@ import { getEnv, getOsType, isWebGLSupported } from "../utils";
export
class
Stage
extends
Container
{
export
class
Stage
extends
Container
{
/**
/**
* 当前stage所使用的渲染器
* stage使用的渲染器
* 渲染器有两种,一种是canvas 一种是webGl
* @property renderObj
* @property renderObj
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @type {
IRend
er}
* @type {
SystemRender
er}
* @default null
* @default null
*/
*/
public
renderObj
:
SystemRenderer
=
null
;
public
renderObj
:
SystemRenderer
=
null
;
/**
/**
*
舞台在设备里截取后的可见区域,有些时候知道可见区域是非常重要的,因为这样你就可以根据舞台的可见区域做自适应了。
*
相对于stage的可见区域,考虑不对外开放,但是有些地方又有用,比如某点是否在舞台可见区域内viewRect.isPointIn(gp)
* @property viewRect
* @property viewRect
* @public
* @public
* @readonly
* @since 1.0.0
* @since 1.0.0
* @type {Rectangle}
* @type {Rectangle}
* @default
{x:0,y:0,width:0,height:0}
* @default
* @readonly
* @readonly
*/
*/
public
viewRect
:
Rectangle
=
new
Rectangle
();
public
viewRect
:
Rectangle
=
new
Rectangle
();
/**
/**
* 舞台
的尺寸宽,也就是我们常说的设计
尺寸
* 舞台
设计尺寸,一般为设计稿内容
尺寸
* @property desWidth
* @property desWidth
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @default
32
0
* @default 0
* @type {number}
* @type {number}
* @readonly
* @readonly
*/
*/
public
desWidth
:
number
=
0
;
public
desWidth
:
number
=
0
;
/**
/**
* 舞台
的尺寸高,也就是我们常说的设计
尺寸
* 舞台
设计尺寸,一般为设计稿内容
尺寸
* @property desHeight
* @property desHeight
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @default
24
0
* @default 0
* @type {number}
* @type {number}
* @readonly
* @readonly
*/
*/
public
desHeight
:
number
=
0
;
public
desHeight
:
number
=
0
;
/**
/**
* 舞台在
当前设备中的真实高
* 舞台在
设备中的显示尺寸
* @property divHeight
* @property divHeight
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @default
32
0
* @default 0
* @type {number}
* @type {number}
* @readonly
* @readonly
*/
*/
public
divHeight
:
number
=
0
;
public
divHeight
:
number
=
0
;
/**
/**
* 舞台在
当前设备中的真实宽
* 舞台在
设备中的显示尺寸
* @property divWidth
* @property divWidth
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @default
24
0
* @default 0
* @readonly
* @readonly
* @type {number}
* @type {number}
*/
*/
public
divWidth
:
number
=
0
;
public
divWidth
:
number
=
0
;
private
_bgColor
:
number
=
0x000000
;
/**
/**
* 舞台的背景色
* 舞台的背景色,暂时无效,渲染器默认透明背景,且webgl模式下clearColor不会跟着修改,TODO 以后修改
* 默认就是透明背景
* 可能设置一个颜色值改变舞台背景
* @property bgColor
* @property bgColor
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @type {number}
* @type {number}
* @default
""
;
* @default
0
;
*/
*/
private
_bgColor
:
number
=
0x000000
;
public
get
bgColor
():
number
{
public
get
bgColor
():
number
{
return
this
.
_bgColor
;
return
this
.
_bgColor
;
}
}
/**
* 设置颜色,即改变渲染器颜色
*/
public
set
bgColor
(
value
:
number
)
{
public
set
bgColor
(
value
:
number
)
{
if
(
this
.
_bgColor
===
value
)
return
if
(
this
.
_bgColor
===
value
)
return
this
.
_bgColor
=
value
;
this
.
_bgColor
=
value
;
...
@@ -104,17 +97,20 @@ export class Stage extends Container {
...
@@ -104,17 +97,20 @@ export class Stage extends Container {
}
}
/**
/**
* 上一次鼠标或触碰经过的显示对象列表
* 上一次鼠标或触碰经过的显示对象列表
,为了over和out事件
* @property _lastDpList
* @property _lastDpList
* @type {Object}
* @type {Object}
* @private
* @private
*/
*/
private
_lastDpList
:
any
=
{};
private
_lastDpList
:
any
=
{};
/**
* 计算画布实际尺寸/显示尺寸所得或构造函数传入设置画布实际尺寸
*/
private
_dpi
:
number
;
private
_dpi
:
number
;
/**
/**
*
*
记录下画布对象
*/
*/
private
canvas
:
HTMLCanvasElement
;
private
canvas
:
HTMLCanvasElement
;
...
@@ -131,6 +127,8 @@ export class Stage extends Container {
...
@@ -131,6 +127,8 @@ export class Stage extends Container {
get
stageHeight
()
{
get
stageHeight
()
{
return
this
.
viewRect
.
height
;
return
this
.
viewRect
.
height
;
}
}
private
_autoSteering
:
boolean
=
false
;
/**
/**
* 是否自动转向,一般对于需要手机横屏自动更新内容朝向的设置为true,自动对齐设计尺寸和屏幕显示尺寸
* 是否自动转向,一般对于需要手机横屏自动更新内容朝向的设置为true,自动对齐设计尺寸和屏幕显示尺寸
* 默认false
* 默认false
...
@@ -139,13 +137,35 @@ export class Stage extends Container {
...
@@ -139,13 +137,35 @@ export class Stage extends Container {
* @type {boolean}
* @type {boolean}
* @default false
* @default false
*/
*/
public
autoSteering
:
boolean
=
false
;
get
autoSteering
()
{
return
this
.
_autoSteering
;
}
set
autoSteering
(
value
:
boolean
)
{
if
(
this
.
_autoSteering
==
value
)
return
;
this
.
_autoSteering
=
value
;
//没啥性能问题,设置了就执行一次
this
.
_setAlign
();
}
private
_scaleMode
:
"fixedWidth"
|
"fixedHeight"
;
/**
/**
* 缩放模式
* 缩放模式,暂时只有 "fixedWidth" | "fixedHeight",
* 以后有需要再加,同时修改构造函数传参fixedHeight
*/
*/
private
_scaleMode
:
"fixedWidth"
|
"fixedHeight"
;
get
scaleMode
():
"fixedWidth"
|
"fixedHeight"
{
return
this
.
_scaleMode
}
set
scaleMode
(
value
:
"fixedWidth"
|
"fixedHeight"
)
{
if
(
this
.
_scaleMode
==
value
)
return
;
this
.
_scaleMode
=
value
;
//没啥性能问题,设置了就执行一次
this
.
_setAlign
();
}
/**
/**
* 舞台是否居中
* 舞台是否居中,
* 不居中则以左上角为00点,
* 否则按照scaleMode均匀裁切上下或左右,用viewRect.xy获取实际裁剪数值
* 暂时外部没有需求,不开放
*/
*/
private
_stageCenter
:
boolean
;
private
_stageCenter
:
boolean
;
/**
/**
...
@@ -274,7 +294,7 @@ export class Stage extends Container {
...
@@ -274,7 +294,7 @@ export class Stage extends Container {
// }
// }
}
}
/**
/**
* 暂时不存在外部调用的情况
*
处理适配,
暂时不存在外部调用的情况
*/
*/
private
_setAlign
()
{
private
_setAlign
()
{
let
s
=
this
;
let
s
=
this
;
...
@@ -297,7 +317,7 @@ export class Stage extends Container {
...
@@ -297,7 +317,7 @@ export class Stage extends Container {
//内容是否为竖屏内容
//内容是否为竖屏内容
let
isDesH
=
desH
>=
desW
;
let
isDesH
=
desH
>=
desW
;
//处理下,显示尺寸宽高颠倒下
//处理下,显示尺寸宽高颠倒下
if
(
s
.
autoSteering
&&
isDesH
!=
isDivH
)
{
if
(
s
.
_
autoSteering
&&
isDesH
!=
isDivH
)
{
let
d
=
divH
;
let
d
=
divH
;
divH
=
divW
;
divH
=
divW
;
divW
=
d
;
divW
=
d
;
...
@@ -307,7 +327,7 @@ export class Stage extends Container {
...
@@ -307,7 +327,7 @@ export class Stage extends Container {
s
.
scaleX
=
scale
;
s
.
scaleX
=
scale
;
s
.
scaleY
=
scale
;
s
.
scaleY
=
scale
;
//未设置自动转向,或不需要转向
//未设置自动转向,或不需要转向
if
(
!
s
.
autoSteering
||
isDesH
==
isDivH
)
{
if
(
!
s
.
_
autoSteering
||
isDesH
==
isDivH
)
{
s
.
rotation
=
0
;
s
.
rotation
=
0
;
//没设置过居中的位移置0
//没设置过居中的位移置0
if
(
!
s
.
_stageCenter
)
s
.
x
=
s
.
y
=
0
if
(
!
s
.
_stageCenter
)
s
.
x
=
s
.
y
=
0
...
@@ -336,12 +356,13 @@ export class Stage extends Container {
...
@@ -336,12 +356,13 @@ export class Stage extends Container {
/**
/**
* 移动端不常用
* 移动端不常用
* 微信浏览器使用情景:ios返回页面下面出现操作栏
* 微信浏览器使用情景:ios返回页面下面出现操作栏
* window.addEventListener('resize', () => {stage.resize()});
* 这里会按照原_dpi修改canvas的实际尺寸
* 这里会按照原_dpi修改canvas的实际尺寸
* 一般设备的dpi不会改变,
* 一般设备的dpi不会改变,
* web全屏环境可不传参数,否则自行计算显示尺寸传入
* web全屏环境可不传参数,否则自行计算显示尺寸传入
* @param divWidth
* @param divWidth
* @param divHeight
* @param divHeight
* @example
* window.addEventListener('resize', () => {stage.resize()});
*/
*/
public
resize
(
divWidth
?:
number
,
divHeight
?:
number
)
{
public
resize
(
divWidth
?:
number
,
divHeight
?:
number
)
{
if
(
getEnv
()
==
"web"
)
{
//web环境不传当作全屏处理
if
(
getEnv
()
==
"web"
)
{
//web环境不传当作全屏处理
...
@@ -370,22 +391,22 @@ export class Stage extends Container {
...
@@ -370,22 +391,22 @@ export class Stage extends Container {
}
}
/**
/**
*
这个是鼠标事件的MouseEvent对象池,因为如果用户有监听鼠标事件,如果不建立对象池,那每一秒将会new Fps个数的事件对象,影响性能
*
鼠标事件MouseEvent对象池
* @property _ml
* @property _ml
* @type {Array}
* @type {Array}
* @private
* @private
*/
*/
private
_ml
:
any
=
[];
private
_ml
:
MouseEvent
[]
=
[];
/**
/**
*
这个是事件中用到的Point对象池,以提高性能
*
鼠标事件中用到的Point对象池
* @property _mp
* @property _mp
* @type {Array}
* @type {Array}
* @private
* @private
*/
*/
private
_mp
:
any
=
[];
private
_mp
:
Point
[]
=
[];
/**
/**
*
刷新mouse或者touch
事件
*
初始化鼠标
事件
* @method _initMouseEvent
* @method _initMouseEvent
* @private
* @private
*/
*/
...
@@ -398,8 +419,8 @@ export class Stage extends Container {
...
@@ -398,8 +419,8 @@ export class Stage extends Container {
event
.
identifier
=
identifier
;
event
.
identifier
=
identifier
;
}
}
//每一个手指事件的对象池
/**
/**
* 每一个手指事件的对象池,为了click事件,得保证down和up是同一个手指标识
* @property _mouseDownPoint
* @property _mouseDownPoint
* @type {Object}
* @type {Object}
* @private
* @private
...
@@ -407,7 +428,7 @@ export class Stage extends Container {
...
@@ -407,7 +428,7 @@ export class Stage extends Container {
private
_mouseDownPoint
:
any
=
{};
private
_mouseDownPoint
:
any
=
{};
/**
/**
*
循环刷新页面的函数
*
渲染器刷新stage
* @method flush
* @method flush
* @private
* @private
* @return {void}
* @return {void}
...
@@ -417,7 +438,7 @@ export class Stage extends Container {
...
@@ -417,7 +438,7 @@ export class Stage extends Container {
}
}
/**
/**
*
html的鼠标或单点触摸对应的引擎事件类型名
*
原始(html或其他)的鼠标事件名和引擎鼠标事件名的映射,TODO,字符串统统用MouseEvent的静态属性代替,事件名只维护一个地方
* touchcancel:"onMouseUp"不常用,先不加
* touchcancel:"onMouseUp"不常用,先不加
* @property _mouseEventTypes
* @property _mouseEventTypes
* @type {{mousedown: string, mouseup: string, mousemove: string, touchstart: string, touchmove: string, touchend: string}}
* @type {{mousedown: string, mouseup: string, mousemove: string, touchstart: string, touchmove: string, touchend: string}}
...
@@ -447,7 +468,7 @@ export class Stage extends Container {
...
@@ -447,7 +468,7 @@ export class Stage extends Container {
*/
*/
public
webMouseEventStopPropagation
:
boolean
;
public
webMouseEventStopPropagation
:
boolean
;
/**
/**
*
无多指,无拖动
*
鼠标事件方法
* @method onMouseEvent
* @method onMouseEvent
* @param e
* @param e
* @private
* @private
...
...
src/2d/events/Event.ts
View file @
12622652
...
@@ -44,7 +44,7 @@ export class Event extends HashObject {
...
@@ -44,7 +44,7 @@ export class Event extends HashObject {
public
static
SCROLL_START
:
string
=
"onScrollStart"
;
public
static
SCROLL_START
:
string
=
"onScrollStart"
;
/**
/**
* ScrollPage组件滑动到结束位置事件
* ScrollPage组件滑动到结束位置事件
* @property
ON_
SCROLL_TO_END
* @property SCROLL_TO_END
* @static
* @static
* @since 1.1.0
* @since 1.1.0
* @type {string}
* @type {string}
...
@@ -71,7 +71,7 @@ export class Event extends HashObject {
...
@@ -71,7 +71,7 @@ export class Event extends HashObject {
/**
/**
* 显示对象从舞台移出事件
* 显示对象从舞台移出事件
* @Event
* @Event
* @property REMOVE
_TO
_STAGE
* @property REMOVE
D_FROM
_STAGE
* @type {string}
* @type {string}
* @static
* @static
* @public
* @public
...
@@ -89,7 +89,7 @@ export class Event extends HashObject {
...
@@ -89,7 +89,7 @@ export class Event extends HashObject {
*/
*/
public
static
ENTER_FRAME
:
string
=
"onEnterFrame"
;
public
static
ENTER_FRAME
:
string
=
"onEnterFrame"
;
/**
/**
*
Movie
Clip 播放完成事件
*
Animation
Clip 播放完成事件
* @Event
* @Event
* @property END_FRAME
* @property END_FRAME
* @type {string}
* @type {string}
...
@@ -98,16 +98,6 @@ export class Event extends HashObject {
...
@@ -98,16 +98,6 @@ export class Event extends HashObject {
* @since 1.0.0
* @since 1.0.0
*/
*/
public
static
END_FRAME
:
string
=
"onEndFrame"
;
public
static
END_FRAME
:
string
=
"onEndFrame"
;
/**
* MovieClip 帧标签事件
* @Event
* @property CALL_FRAME
* @type {string}
* @static
* @public
* @since 1.0.0
*/
public
static
CALL_FRAME
:
string
=
"onCallFrame"
;
/**
/**
* 完成事件
* 完成事件
* @Event
* @Event
...
@@ -234,7 +224,7 @@ export class Event extends HashObject {
...
@@ -234,7 +224,7 @@ export class Event extends HashObject {
}
}
/**
/**
* 重
围事件到初始状态方便重复利用
* 重
置事件
* @method reset
* @method reset
* @param {string} type
* @param {string} type
* @param target
* @param target
...
...
src/2d/events/EventDispatcher.ts
View file @
12622652
...
@@ -36,7 +36,7 @@ export class EventDispatcher extends HashObject {
...
@@ -36,7 +36,7 @@ export class EventDispatcher extends HashObject {
public
static
_totalMEC
:
number
=
0
;
public
static
_totalMEC
:
number
=
0
;
/**
/**
*
看看有多少mouse或者touch侦听数
*
获取鼠标事件数量
* @method getMouseEventCount
* @method getMouseEventCount
* @return {number}
* @return {number}
* @static
* @static
...
@@ -62,16 +62,16 @@ export class EventDispatcher extends HashObject {
...
@@ -62,16 +62,16 @@ export class EventDispatcher extends HashObject {
}
}
/**
/**
* 给对象添加
一个侦
听
* 给对象添加
事件监
听
* @method addEventListener
* @method addEventListener
* @public
* @public
* @since 1.0.0
* @since 1.0.0
* @param {string} type
侦
听类形
* @param {string} type
监
听类形
* @param {Function}listener
侦听后的回调方法,如果这个方法是类实例的
方法
* @param {Function}listener
监听后的回调
方法
* @param
context thisObject
* @param
{*}context listener中的this指向
* @param {boolean} useCapture true 捕获阶段 false 冒泡阶段 默认 true
* @param {boolean} useCapture true 捕获阶段 false 冒泡阶段 默认 true
* @example
* @example
* this.addEventListener(
Event.ADD_TO_STAGE,function(e){console.log(this
);},this);
* this.addEventListener(
"eventName",function(e){console.log(e
);},this);
*/
*/
public
addEventListener
(
type
:
string
,
listener
:
Function
,
context
?:
any
,
useCapture
:
boolean
=
true
):
this
{
public
addEventListener
(
type
:
string
,
listener
:
Function
,
context
?:
any
,
useCapture
:
boolean
=
true
):
this
{
if
(
!
type
)
{
if
(
!
type
)
{
...
...
src/2d/events/MouseEvent.ts
View file @
12622652
import
{
Event
}
from
"./Event"
;
import
{
Event
}
from
"./Event"
;
import
{
DisplayObject
}
from
"../display/DisplayObject"
;
import
{
DisplayObject
}
from
"../display/DisplayObject"
;
/**
/**
* 鼠标事件类
,电脑端鼠标,移动设备端的触摸都使用此事件来监听
* 鼠标事件类
* @class MouseEvent
* @class MouseEvent
* @extends Event
* @extends Event
* @public
* @public
...
@@ -9,7 +9,7 @@ import { DisplayObject } from "../display/DisplayObject";
...
@@ -9,7 +9,7 @@ import { DisplayObject } from "../display/DisplayObject";
*/
*/
export
class
MouseEvent
extends
Event
{
export
class
MouseEvent
extends
Event
{
/**
/**
* 鼠标
或者手指
按下事件
* 鼠标按下事件
* @property MOUSE_DOWN
* @property MOUSE_DOWN
* @static
* @static
* @public
* @public
...
@@ -18,7 +18,7 @@ export class MouseEvent extends Event {
...
@@ -18,7 +18,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
MOUSE_DOWN
:
string
=
"onMouseDown"
;
public
static
MOUSE_DOWN
:
string
=
"onMouseDown"
;
/**
/**
* 鼠标
或者手指
抬起事件
* 鼠标抬起事件
* @property MOUSE_UP
* @property MOUSE_UP
* @static
* @static
* @public
* @public
...
@@ -27,7 +27,7 @@ export class MouseEvent extends Event {
...
@@ -27,7 +27,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
MOUSE_UP
:
string
=
"onMouseUp"
;
public
static
MOUSE_UP
:
string
=
"onMouseUp"
;
/**
/**
* 鼠标
或者手指单击
* 鼠标
点击事件
* @property CLICK
* @property CLICK
* @static
* @static
* @public
* @public
...
@@ -36,7 +36,7 @@ export class MouseEvent extends Event {
...
@@ -36,7 +36,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
CLICK
:
string
=
"onMouseClick"
;
public
static
CLICK
:
string
=
"onMouseClick"
;
/**
/**
* 鼠标
或者手指
移动事件
* 鼠标移动事件
* @property MOUSE_MOVE
* @property MOUSE_MOVE
* @static
* @static
* @public
* @public
...
@@ -45,7 +45,7 @@ export class MouseEvent extends Event {
...
@@ -45,7 +45,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
MOUSE_MOVE
:
string
=
"onMouseMove"
;
public
static
MOUSE_MOVE
:
string
=
"onMouseMove"
;
/**
/**
* 鼠标
或者手指
移入到显示对象上里触发的事件
* 鼠标移入到显示对象上里触发的事件
* @property MOUSE_OVER
* @property MOUSE_OVER
* @static
* @static
* @public
* @public
...
@@ -54,7 +54,7 @@ export class MouseEvent extends Event {
...
@@ -54,7 +54,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
MOUSE_OVER
:
string
=
"onMouseOver"
;
public
static
MOUSE_OVER
:
string
=
"onMouseOver"
;
/**
/**
* 鼠标
或者手指
移出显示对象边界触发的事件
* 鼠标移出显示对象边界触发的事件
* @property MOUSE_OUT
* @property MOUSE_OUT
* @static
* @static
* @public
* @public
...
@@ -63,7 +63,7 @@ export class MouseEvent extends Event {
...
@@ -63,7 +63,7 @@ export class MouseEvent extends Event {
*/
*/
public
static
MOUSE_OUT
:
string
=
"onMouseOut"
;
public
static
MOUSE_OUT
:
string
=
"onMouseOut"
;
/**
/**
*
mouse或touch
事件时canvas实际尺寸坐标x点
*
鼠标
事件时canvas实际尺寸坐标x点
* @property clientX
* @property clientX
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -71,7 +71,7 @@ export class MouseEvent extends Event {
...
@@ -71,7 +71,7 @@ export class MouseEvent extends Event {
*/
*/
public
clientX
:
number
=
0
;
public
clientX
:
number
=
0
;
/**
/**
*
mouse或touch
事件时canvas实际尺寸坐标y点
*
鼠标
事件时canvas实际尺寸坐标y点
* @property clientY
* @property clientY
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -79,7 +79,7 @@ export class MouseEvent extends Event {
...
@@ -79,7 +79,7 @@ export class MouseEvent extends Event {
*/
*/
public
clientY
:
number
=
0
;
public
clientY
:
number
=
0
;
/**
/**
*
mouse或touch
事件时stage上坐标x点
*
鼠标
事件时stage上坐标x点
* @property stageX
* @property stageX
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -87,7 +87,7 @@ export class MouseEvent extends Event {
...
@@ -87,7 +87,7 @@ export class MouseEvent extends Event {
*/
*/
public
stageX
:
number
=
0
;
public
stageX
:
number
=
0
;
/**
/**
*
mouse或touch
事件时stage上坐标y点
*
鼠标
事件时stage上坐标y点
* @property stageY
* @property stageY
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -95,7 +95,7 @@ export class MouseEvent extends Event {
...
@@ -95,7 +95,7 @@ export class MouseEvent extends Event {
*/
*/
public
stageY
:
number
=
0
;
public
stageY
:
number
=
0
;
/**
/**
*
mouse或touch
事件时显示对象本地坐标x点
*
鼠标
事件时显示对象本地坐标x点
* @property localX
* @property localX
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -103,7 +103,7 @@ export class MouseEvent extends Event {
...
@@ -103,7 +103,7 @@ export class MouseEvent extends Event {
*/
*/
public
localX
:
number
=
0
;
public
localX
:
number
=
0
;
/**
/**
*
mouse或touch
事件时显示对象本地坐标y点
*
鼠标
事件时显示对象本地坐标y点
* @property localY
* @property localY
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -111,7 +111,7 @@ export class MouseEvent extends Event {
...
@@ -111,7 +111,7 @@ export class MouseEvent extends Event {
*/
*/
public
localY
:
number
=
0
;
public
localY
:
number
=
0
;
/**
/**
*
触发事件的终点对象
*
鼠标事件的终点对象,注意区分target
* @property currentTarget
* @property currentTarget
* @public
* @public
* @since 1.0.0
* @since 1.0.0
...
@@ -120,7 +120,7 @@ export class MouseEvent extends Event {
...
@@ -120,7 +120,7 @@ export class MouseEvent extends Event {
*/
*/
public
currentTarget
:
DisplayObject
=
null
;
public
currentTarget
:
DisplayObject
=
null
;
/**
/**
*
触摸或者
鼠标事件的手指唯一标识
* 鼠标事件的手指唯一标识
* @property identifier
* @property identifier
* @type {number}
* @type {number}
* @since 1.1.2
* @since 1.1.2
...
...
src/2d/graphics/Shape.ts
View file @
12622652
...
@@ -202,7 +202,7 @@ export class Shape extends Sprite {
...
@@ -202,7 +202,7 @@ export class Shape extends Sprite {
/**
/**
* 三次贝赛尔曲线
* 三次贝赛尔曲线
* 从上一点画二次贝赛尔曲线到某一点,如果没有设置上一点,则上一
占
默认为(0,0)
* 从上一点画二次贝赛尔曲线到某一点,如果没有设置上一点,则上一
点
默认为(0,0)
* @method bezierCurveTo
* @method bezierCurveTo
* @param {number} cp1X 1控制点X
* @param {number} cp1X 1控制点X
* @param {number} cp1Y 1控制点Y
* @param {number} cp1Y 1控制点Y
...
@@ -434,7 +434,7 @@ export class Shape extends Sprite {
...
@@ -434,7 +434,7 @@ export class Shape extends Sprite {
}
}
/**
/**
* 线条位图填充
一般给Flash2x用
* 线条位图填充
* @method beginBitmapStroke
* @method beginBitmapStroke
* @param {Image} image
* @param {Image} image
* @param {Array} matrix
* @param {Array} matrix
...
...
src/2d/text/TextField.ts
View file @
12622652
...
@@ -9,11 +9,9 @@ import { BaseTexture } from "../texture";
...
@@ -9,11 +9,9 @@ import { BaseTexture } from "../texture";
//文本canvas上xy的偏移量
//文本canvas上xy的偏移量
const
padding
=
10
;
const
padding
=
10
;
/**
/**
* 到时有离屏canvas再修改,现在离屏canvasios有问题,且文本模糊
* 动态文本类
* 继承Sprite,暂时发现,只需要切换bitmap和Sprite,TextField永远都是最新的,到时替换
* 动态文本类,有时需要在canvas里有一个动态文本,能根据我们的显示内容来改变
* @class TextField
* @class TextField
* @extends
DisplayObject
* @extends
Sprite
* @since 1.0.0
* @since 1.0.0
* @public
* @public
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment