Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PET-rating
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Heikkilä
PET-rating
Commits
1cf8be2a
Commit
1cf8be2a
authored
5 years ago
by
Ossi Laine
Browse files
Options
Downloads
Patches
Plain Diff
Add masking image
parent
72c5ed22
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/static/img/dummy_600_mask.png
+0
-0
0 additions, 0 deletions
app/static/img/dummy_600_mask.png
app/static/js/canvas.js
+2
-29
2 additions, 29 deletions
app/static/js/canvas.js
app/task/views.py
+0
-19
0 additions, 19 deletions
app/task/views.py
with
2 additions
and
48 deletions
app/static/img/dummy_600_mask.png
0 → 100644
+
0
−
0
View file @
1cf8be2a
46.5 KiB
This diff is collapsed.
Click to expand it.
app/static/js/canvas.js
+
2
−
29
View file @
1cf8be2a
...
...
@@ -7,12 +7,7 @@ $(document).ready(function() {
try
{
var
canvas
=
$
(
"
#embody-canvas
"
)
var
context
=
document
.
getElementById
(
"
embody-canvas
"
).
getContext
(
"
2d
"
);
// Base image
var
img
=
document
.
getElementById
(
"
baseImage
"
);
console
.
log
(
img
)
console
.
log
(
canvas
)
}
catch
(
e
)
{
console
.
log
(
e
)
if
(
e
instanceof
TypeError
)
{
...
...
@@ -59,6 +54,7 @@ $(document).ready(function() {
// TODO: changing drawradius doesnt affect to the saved datapoints !!!
// Bigger brush should make more datapoints compared to smaller ones.
// add brush size to click arry -> {x:[...], y:[...], size:[...]} ??
$
(
"
.canvas-container
"
).
bind
(
'
DOMMouseScroll
'
,
function
(
event
)
{
//event.preventDefault()
...
...
@@ -128,7 +124,6 @@ $(document).ready(function() {
}
function
redraw
(){
/*
Check:
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
...
...
@@ -152,28 +147,10 @@ $(document).ready(function() {
// Draw circle with gradient
drawPoint
(
lastX
,
lastY
,
drawRadius
)
drawMaskToBaseImage
()
/*
OLD version, where line is drawn continuously (not needed probably)
for(var i=0; i < clickX.length; i++) {
context.beginPath();
if (clickDrag[i] && i) {
context.moveTo(clickX[i-1], clickY[i-1]);
} else {
context.moveTo(clickX[i]-1, clickY[i]);
}
context.lineTo(clickX[i], clickY[i]);
context.closePath();
context.stroke();
}
*/
}
// This is not needed, because canvas dont allow to draw on white points (mask points)
function
drawMaskToBaseImage
()
{
var
img
=
document
.
getElementById
(
"
baseImageMask
"
);
...
...
@@ -212,12 +189,8 @@ $(document).ready(function() {
}
points
=
JSON
.
stringify
(
points
)
console
.
log
(
points
)
$
(
"
#canvas-data
"
).
val
(
points
);
$
(
"
#canvas-form
"
).
submit
();
}
drawBaseImage
()
...
...
This diff is collapsed.
Click to expand it.
app/task/views.py
+
0
−
19
View file @
1cf8be2a
...
...
@@ -72,8 +72,6 @@ def update_answer_set_type(answer_type):
the_time
=
datetime
.
now
()
the_time
=
the_time
.
replace
(
microsecond
=
0
)
print
(
"
UPDATE TYPE
"
)
updated_answer_set
=
answer_set
.
query
.
filter_by
(
idanswer_set
=
session
[
'
answer_set
'
]).
first
()
updated_answer_set
.
answer_type
=
answer_type
updated_answer_set
.
last_answer_time
=
the_time
...
...
@@ -86,9 +84,6 @@ def select_form_type():
form
=
None
answer_set_type
=
answer_set
.
query
.
filter_by
(
idanswer_set
=
session
[
'
answer_set
'
]).
first
().
answer_type
print
(
session
[
'
answer_set
'
])
print
(
answer_set_type
)
if
answer_set_type
==
'
slider
'
:
form
=
TaskForm
()
...
...
@@ -148,8 +143,6 @@ def slider_on():
experiment_info
=
get_experiment_info
()
questions
=
question
.
query
.
filter_by
(
experiment_idexperiment
=
experiment_info
.
idexperiment
).
all
()
print
(
questions
)
if
len
(
questions
)
==
0
:
return
False
return
True
...
...
@@ -184,7 +177,6 @@ def task_embody(page_num):
# Check if there are unanswered slider questions -> if true redirect to same page
if
slider_on
():
print
(
"
SLIDER ON
"
)
update_answer_set_type
(
'
slider
'
)
return
redirect
(
url_for
(
'
task.task
'
,
page_num
=
page_num
))
...
...
@@ -245,17 +237,6 @@ def task(page_num):
randomized_page_id
=
get_randomized_page
(
page_id
).
randomized_idpage
randomized_stimulus
=
page
.
query
.
filter_by
(
idpage
=
randomized_page_id
).
first
()
# OLD
for
p
in
pages
.
items
:
#session['current_idpage'] = p.idpage
print
(
'
p.idpage -loop:
'
,
p
.
idpage
)
# TODO: if no form found -> go to next page
# TODO: check if embody ON and no answer
return
render_template
(
'
task.html
'
,
pages
=
pages
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment