Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-engine
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
劳工
zeroing-engine
Commits
ff29b190
Commit
ff29b190
authored
Mar 23, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复html视图不能滚动的限制
parent
43f8406e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
26 deletions
+39
-26
manifest.json
manifest.json
+1
-1
FloatDisplay.ts
src/2d/display/FloatDisplay.ts
+35
-23
Stage.ts
src/2d/display/Stage.ts
+3
-2
No files found.
manifest.json
View file @
ff29b190
{
"id"
:
"engine"
,
"url"
:
"engine.85a610a71df748fd9a6ece34f456a06e8f3f1b63.js"
}
\ No newline at end of file
{
"id"
:
"engine"
,
"url"
:
"engine.47eb390007c368d3dc5648734153301ebead724b.js"
}
\ No newline at end of file
src/2d/display/FloatDisplay.ts
View file @
ff29b190
...
...
@@ -83,32 +83,42 @@ export class FloatDisplay extends DisplayObject {
}
});
s
.
addEventListener
(
Event
.
ADDED_TO_STAGE
,
function
(
e
:
Event
)
{
if
(
!
container
){
container
=
document
.
createElement
(
'div'
);
container
.
style
.
position
=
"absolute"
;
container
.
style
.
left
=
"0"
;
container
.
style
.
top
=
"0"
;
container
.
style
.
fontSize
=
'30px'
;
container
.
style
.
lineHeight
=
'normal'
;
s
.
stage
.
rootDiv
.
appendChild
(
container
);
//, s.stage.rootDiv.childNodes[0]
}
if
(
s
.
_htmlElement
)
{
let
style
=
s
.
_htmlElement
.
style
;
if
(
!
s
.
_isAdded
)
{
s
.
_isAdded
=
true
;
container
.
appendChild
(
s
.
_htmlElement
);
s
.
stage
[
"_floatDisplayList"
].
push
(
s
);
}
else
{
if
(
s
.
_htmlElement
&&
s
.
visible
)
{
style
.
display
=
"block"
;
}
}
}
});
this
.
addHtmlElement
();
},
s
);
this
.
_transformID
=
-
1
;
}
addHtmlElement
()
{
let
s
=
this
;
if
(
!
s
.
stage
){
return
;
}
if
(
!
container
)
{
container
=
document
.
createElement
(
'div'
);
container
.
style
.
position
=
"absolute"
;
container
.
style
.
left
=
"0"
;
container
.
style
.
top
=
"0"
;
container
.
style
.
fontSize
=
'30px'
;
container
.
style
.
lineHeight
=
'normal'
;
s
.
stage
.
rootDiv
.
appendChild
(
container
);
//, s.stage.rootDiv.childNodes[0]
}
if
(
s
.
_htmlElement
)
{
let
style
=
s
.
_htmlElement
.
style
;
if
(
!
s
.
_isAdded
)
{
s
.
_isAdded
=
true
;
container
.
appendChild
(
s
.
_htmlElement
);
s
.
stage
[
"_floatDisplayList"
].
push
(
s
);
}
else
{
if
(
s
.
_htmlElement
&&
s
.
visible
)
{
style
.
display
=
"block"
;
}
}
}
}
get
htmlElement
()
{
return
this
.
_htmlElement
;
}
...
...
@@ -126,7 +136,7 @@ export class FloatDisplay extends DisplayObject {
* @param {HtmlElement} htmlElement 需要封装起来的html元素的引用。你可以通过这个引用来调用或设置此元素自身的属性方法和事件,甚至是样式
*/
protected
init
(
htmlElement
:
any
):
void
{
if
(
!
htmlElement
)
{
if
(
!
htmlElement
)
{
return
;
}
let
s
=
this
;
...
...
@@ -160,6 +170,8 @@ export class FloatDisplay extends DisplayObject {
s
.
_localBoundsSelf
.
width
=
w
;
s
.
_localBoundsSelf
.
height
=
h
;
s
.
_htmlElement
=
she
;
this
.
addHtmlElement
();
}
/**
...
...
src/2d/display/Stage.ts
View file @
ff29b190
...
...
@@ -438,7 +438,7 @@ export class Stage extends Container {
s
.
dispatchEvent
(
Event
.
ON_INIT_STAGE
);
// }
},
100
);
let
rc
=
canvas
;
//s.rootDiv;
let
rc
=
s
.
rootDiv
;
//canvas
let
mouseEvent
=
s
.
onMouseEvent
.
bind
(
s
);
//鼠标事件
if
(
osType
!=
"pc"
)
{
...
...
@@ -648,8 +648,9 @@ export class Stage extends Container {
cp
=
new
Point
();
}
let
rootDiv
=
s
.
rootDiv
;
let
doc
=
document
.
documentElement
;
let
box
=
points
[
o
].
target
.
getBoundingClientRect
();
let
box
=
rootDiv
.
getBoundingClientRect
();
//points[o].target
let
left
=
box
.
left
+
window
.
pageXOffset
-
doc
.
clientLeft
;
let
top
=
box
.
top
+
window
.
pageYOffset
-
doc
.
clientTop
;
cp
.
x
=
(
points
[
o
].
pageX
-
left
)
*
devicePixelRatio
;
...
...
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