Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
YM4-13
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
YM4-13
Commits
9b57d0db
Commit
9b57d0db
authored
Nov 09, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buf fix for bg image
parent
2780e884
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
200 additions
and
124 deletions
+200
-124
custom-hot-zone.component.ts
...common/custom-hot-zone-ym413/custom-hot-zone.component.ts
+32
-11
form.component.html
src/app/form/form.component.html
+9
-6
bg_330_168.png
src/assets/default/YM413/images/bg_330_168.png
+0
-0
default_itemBG.png
src/assets/default/YM413/images/default_itemBG.png
+0
-0
defaultData_ym413.js
src/assets/default/formData/defaultData_ym413.js
+158
-107
defalut_bg.png
src/assets/play/defalut_bg.png
+0
-0
tsconfig.json
tsconfig.json
+1
-0
No files found.
src/app/common/custom-hot-zone-ym413/custom-hot-zone.component.ts
View file @
9b57d0db
...
...
@@ -27,6 +27,7 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
@
Input
()
zoneWidth
:
number
=
960
;
@
Input
()
zoneHeight
:
number
=
155
;
@
Input
()
title
:
string
=
"
选区
"
;
@
Input
()
assetsRoot
:
string
=
""
;
@
Input
()
defaultBGImage
:
string
=
""
;
@
Input
()
defaultItemBG
:
string
=
""
;
@
Input
()
itemWidth
:
number
=
50
;
...
...
@@ -88,8 +89,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
this
.
canvasBaseH
=
Number
(
this
.
zoneHeight
);
if
(
!
this
.
bgItem
.
url
){
this
.
bgItem
.
url
=
this
.
defaultBGImage
this
.
bgItem
.
url
=
this
.
getURL
(
this
.
defaultBGImage
)
}
else
{
this
.
bgItem
.
url
=
this
.
getURL
(
this
.
bgItem
.
url
)
}
this
.
init
();
this
.
initListener
();
this
.
update
();
...
...
@@ -112,8 +116,9 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
this
.
renderArr
.
push
(
this
.
bg
);
}
const
bg
=
this
.
bg
;
if
(
this
.
bgItem
.
url
)
{
bg
.
load
(
this
.
bgItem
.
url
).
then
(()
=>
{
if
(
this
.
getURL
(
this
.
bgItem
.
url
))
{
bg
.
load
(
this
.
getURL
(
this
.
bgItem
.
url
)).
then
(()
=>
{
const
rate1
=
this
.
canvasWidth
/
bg
.
width
;
const
rate2
=
this
.
canvasHeight
/
bg
.
height
;
const
rate
=
Math
.
min
(
rate1
,
rate2
);
...
...
@@ -160,7 +165,6 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
let
mached
=
false
;
this
.
hotZoneArr
.
forEach
(
element
=>
{
if
(
element
.
uid
==
uid
)
{
console
.
log
(
uid
,
element
)
element
.
audio_url
=
audio_url
;
mached
=
true
;
}
...
...
@@ -199,10 +203,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
const
itemW
=
this
.
itemWidth
;
const
itemH
=
this
.
itemHeight
;
const
item
=
new
HotZoneImageItem
(
this
.
ctx
);
let
imageUrl
=
""
if
(
saveData
)
{
item
.
initFont
(
this
.
fontSize
,
this
.
fontName
,
this
.
fontColor
)
item
.
init
(
saveData
.
media
.
image_url
,
saveData
.
media
.
text
,
saveData
.
media
.
type
,
(
w
,
h
)
=>
{
imageUrl
=
this
.
getURL
(
saveData
.
media
.
image_url
);
item
.
init
(
imageUrl
,
saveData
.
media
.
text
,
saveData
.
media
.
type
,
(
w
,
h
)
=>
{
const
saveRect
=
saveData
.
rect
;
item
.
scaleX
=
(
saveData
.
rect
.
width
/
saveData
.
scale
)
/
w
;
item
.
scaleY
=
(
saveData
.
rect
.
height
/
saveData
.
scale
)
/
h
;
...
...
@@ -210,14 +215,15 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
item
.
y
=
saveRect
.
y
/
saveData
.
scale
+
newRect
.
y
});
item
.
uid
=
saveData
.
uid
item
.
image_url
=
saveData
.
media
.
image_u
rl
item
.
image_url
=
imageU
rl
item
.
text
=
saveData
.
media
.
text
?
saveData
.
media
.
text
:
""
item
.
type
=
saveData
.
media
.
type
item
.
audio_url
=
saveData
.
media
.
audio_url
?
saveData
.
media
.
audio_url
:
""
}
else
{
item
.
uid
=
uuid
.
v4
()
imageUrl
=
this
.
getURL
(
this
.
defaultItemBG
);
item
.
initFont
(
this
.
fontSize
,
this
.
fontName
,
this
.
fontColor
)
item
.
init
(
this
.
defaultItemBG
,
""
,
"
Text
"
,
()
=>
{
item
.
init
(
imageUrl
,
""
,
"
Text
"
,
()
=>
{
item
.
x
=
this
.
canvasWidth
/
2
-
this
.
itemWidth
/
2
;
item
.
y
=
this
.
canvasHeight
/
2
-
20
;
},
()
=>
this
.
autoSave
());
...
...
@@ -617,12 +623,16 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
autoSave
()
{
// console.log("Auto save")
const
bgItem
=
this
.
bgItem
;
// const bgItem = JSON.parse(JSON.stringify(this.bgItem));
const
bgItem
=
this
.
bgItem
if
(
this
.
bg
)
{
bgItem
[
'
rect
'
]
=
this
.
bg
.
getBoundingBox
();
}
else
{
bgItem
[
'
rect
'
]
=
{
x
:
0
,
y
:
0
,
width
:
Math
.
round
(
this
.
canvasWidth
*
100
)
/
100
,
height
:
Math
.
round
(
this
.
canvasHeight
*
100
)
/
100
};
}
if
(
this
.
bgItem
.
url
.
indexOf
(
"
http
"
)
==
-
1
)
{
bgItem
.
url
=
this
.
defaultBGImage
}
const
hotZoneItemArr
=
[];
const
hotZoneArr
=
this
.
hotZoneArr
;
...
...
@@ -640,7 +650,11 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
hotZoneItem
[
'
rect
'
].
y
=
(
Math
.
round
((
currentY
-
bgItem
[
'
rect
'
].
y
)
*
1000
)
/
1000
)
*
this
.
scale
;
hotZoneItem
[
'
rect
'
].
width
=
(
Math
.
round
((
hotZoneItem
[
'
rect
'
].
width
)
*
1000
)
/
1000
)
*
this
.
scale
;
hotZoneItem
[
'
rect
'
].
height
=
(
Math
.
round
((
hotZoneItem
[
'
rect
'
].
height
)
*
1000
)
/
1000
)
*
this
.
scale
;
hotZoneItem
[
'
media
'
].
image_url
=
hotZoneArr
[
i
].
image_url
if
(
hotZoneArr
[
i
].
image_url
.
indexOf
(
"
http
"
)
==
-
1
)
{
hotZoneItem
[
'
media
'
].
image_url
=
this
.
defaultItemBG
}
else
{
hotZoneItem
[
'
media
'
].
image_url
=
hotZoneArr
[
i
].
image_url
}
hotZoneItem
[
'
media
'
].
text
=
hotZoneArr
[
i
].
text
hotZoneItem
[
'
media
'
].
type
=
hotZoneArr
[
i
].
type
hotZoneItem
[
'
media
'
].
audio_url
=
hotZoneArr
[
i
].
audio_url
?
hotZoneArr
[
i
].
audio_url
:
""
...
...
@@ -650,8 +664,15 @@ export class CustomHotZoneComponent implements OnInit, OnDestroy {
this
.
hotZoneChanged
=
false
;
}
getURL
(
url
:
string
)
{
if
(
url
.
indexOf
(
"
http
"
)
==-
1
&&
url
.
indexOf
(
"
/
"
)
==-
1
){
return
this
.
assetsRoot
.
replace
(
/_PH_IMAGE_NAME_/g
,
url
)
}
else
{
return
url
}
}
saveClick
()
{
// console.log("Saved")
this
.
autoSave
()
}
}
src/app/form/form.component.html
View file @
9b57d0db
...
...
@@ -42,8 +42,9 @@
zoneWidth =
"330"
zoneHeight =
"168"
[
customBackground
]
=
"
true
"
defaultBGImage =
"assets/default/images/bg_330_168.png"
defaultItemBG =
"assets/default/images/default_itemBG.png"
assetsRoot=
"assets/default/YM413/images/_PH_IMAGE_NAME_.png"
defaultBGImage =
"bg_330_168"
defaultItemBG =
"default_itemBG"
[
itemWidth
]
=
"
240
"
[
itemHeight
]
=
"
114
"
[
bgItem
]="
bgItemLeft
"
...
...
@@ -191,8 +192,9 @@
zoneWidth =
"330"
zoneHeight =
"168"
[
customBackground
]
=
"
true
"
defaultBGImage =
"assets/default/images/bg_330_168.png"
defaultItemBG =
"assets/default/images/default_itemBG.png"
assetsRoot=
"assets/default/YM413/images/_PH_IMAGE_NAME_.png"
defaultBGImage =
"bg_330_168"
defaultItemBG =
"default_itemBG"
[
itemWidth
]
=
"
240
"
[
itemHeight
]
=
"
114
"
[(
bgItem
)]="
bgItemMiddle
"
...
...
@@ -340,8 +342,9 @@
zoneWidth =
"330"
zoneHeight =
"168"
[
customBackground
]
=
"
true
"
defaultBGImage =
"assets/default/images/bg_330_168.png"
defaultItemBG =
"assets/default/images/default_itemBG.png"
assetsRoot=
"assets/default/YM413/images/_PH_IMAGE_NAME_.png"
defaultBGImage =
"bg_330_168"
defaultItemBG =
"default_itemBG"
[
itemWidth
]
=
"
240
"
[
itemHeight
]
=
"
114
"
[(
bgItem
)]="
bgItemRight
"
...
...
src/assets/default/YM413/images/bg_330_168.png
0 → 100644
View file @
9b57d0db
2.08 KB
src/assets/default/YM413/images/default_itemBG.png
0 → 100644
View file @
9b57d0db
2.12 KB
src/assets/default/formData/defaultData_ym413.js
View file @
9b57d0db
This diff is collapsed.
Click to expand it.
src/assets/play/defalut_bg.png
0 → 100644
View file @
9b57d0db
2.06 KB
tsconfig.json
View file @
9b57d0db
...
...
@@ -21,6 +21,7 @@
]
},
"angularCompilerOptions"
:
{
"enableIvy"
:
false
,
"fullTemplateTypeCheck"
:
true
,
"strictInjectionParameters"
:
true
}
...
...
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