Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
3e5b09f4
Commit
3e5b09f4
authored
Sep 07, 2017
by
bbaer
Browse files
Reworked Text Boxes
parent
936044d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
extension/Resources/Public/icons/no_bg.png
0 → 100644
View file @
3e5b09f4
1.46 KB
extension/Resources/Public/icons/white_bg.png
0 → 100644
View file @
3e5b09f4
733 Bytes
extension/Resources/Public/icons/yellow_bg.png
0 → 100644
View file @
3e5b09f4
634 Bytes
javascript/src/Plugins/qfq.fabric.js
View file @
3e5b09f4
...
...
@@ -132,6 +132,29 @@ $(function () {
canvas
.
renderAll
();
}
function
addText
(
displayText
)
{
var
text
=
new
fabric
.
Text
(
displayText
,
{
fontSize
:
textSize
,
color
:
'
#000
'
,
left
:
10
,
top
:
10
});
var
rect
=
new
fabric
.
Rect
();
rect
.
set
({
width
:
text
.
width
+
20
,
height
:
text
.
height
+
20
,
fill
:
bgColor
,
opacity
:
bgOpacity
});
var
group
=
new
fabric
.
Group
([
rect
,
text
],
{
left
:
addPositionLeft
,
top
:
addPositionTop
});
canvas
.
add
(
group
);
canvas
.
setActiveGroup
(
group
);
adjustDefaultPosition
();
}
// Custom Mouse / Touch Events on Canvas
canvas
.
on
(
'
mouse:up
'
,
function
(
e
)
{
...
...
@@ -185,27 +208,7 @@ $(function () {
$
(
"
#text-bg-submit
"
).
on
(
"
click
"
,
function
()
{
deactivateToggles
();
var
userText
=
$
(
"
#text-user-value
"
).
val
();
console
.
log
(
userText
);
var
text
=
new
fabric
.
Text
(
userText
,
{
fontSize
:
textSize
,
color
:
'
#000
'
,
left
:
10
,
top
:
10
});
var
rect
=
new
fabric
.
Rect
();
rect
.
set
({
width
:
text
.
width
+
20
,
height
:
text
.
height
+
20
,
fill
:
bgColor
,
opacity
:
bgOpacity
});
var
group
=
new
fabric
.
Group
([
rect
,
text
],
{
left
:
addPositionLeft
,
top
:
addPositionTop
});
canvas
.
add
(
group
);
canvas
.
setActiveGroup
(
group
);
adjustDefaultPosition
();
addText
(
userText
);
$
(
"
#text-user-value
"
).
val
(
''
);
});
...
...
@@ -239,8 +242,7 @@ $(function () {
});
$
(
"
#add-text
"
).
on
(
"
click
"
,
function
()
{
var
text
=
new
fabric
.
IText
(
'
type your text here
'
,
{
fontSize
:
20
,
left
:
100
,
top
:
100
,
editable
:
true
});
canvas
.
add
(
text
);
$
(
"
#user-text-control
"
).
slideToggle
();
deactivateDrawing
();
});
...
...
mockup/fabric.html
View file @
3e5b09f4
...
...
@@ -45,7 +45,7 @@
<button
class=
"btn btn-default"
id=
"add-rect"
><span
class=
"glyphicon glyphicon-stop"
></span></button>
<button
class=
"btn btn-default"
id=
"move-mode"
><span
class=
"glyphicon glyphicon-move"
></span></button>
</div>
<div
class=
"text-insert"
>
<div
class=
"text-insert"
style=
"display:none;"
id=
"user-text-control"
>
<textarea
class=
"fabric-text"
placeholder=
"Remember, be nice!"
id=
"text-user-value"
></textarea>
<div
class=
"text-options"
>
<button
type=
"button"
class=
"text-bg-toggle"
id=
"text-no-bg"
></button>
...
...
Write
Preview
Supports
Markdown
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