Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
137
Merge Requests
137
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
a06535ce
Commit
a06535ce
authored
Mar 30, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: move data url generation in a renderjs service
Display the capture screen as fast as possible
parent
884c49df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
...tem/web_page_module/scanner_gadget_document_scanner_js.js
+22
-10
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
...em/web_page_module/scanner_gadget_document_scanner_js.xml
+2
-2
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
View file @
a06535ce
...
...
@@ -186,12 +186,26 @@
}
function
handleAsyncStore
(
gadget
,
blob_page
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
gadget
.
state
[
'
blob_url_
'
+
blob_page
]
===
undefined
)
{
// Slow, takes 2 seconds or more on mobile.
return
new
RSVP
.
Queue
(
promiseCanvasToBlob
(
gadget
.
state
[
'
blob_canvas_
'
+
blob_page
],
0.85
)
)
.
push
(
function
(
blob
)
{
return
jIO
.
util
.
readBlobAsDataURL
(
blob
);
})
.
push
(
function
(
evt
)
{
gadget
.
state
[
'
blob_url_
'
+
blob_page
]
=
evt
.
target
.
result
;
});
}
})
.
push
(
function
()
{
var
data
=
new
FormData
();
data
.
append
(
"
input_value
"
,
gadget
.
state
[
'
blob_url_
'
+
blob_page
].
split
(
'
;
'
)[
1
].
split
(
'
,
'
)[
1
]);
data
.
append
(
"
active_process_url
"
,
gadget
.
state
.
active_process
);
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
"
type
"
:
"
POST
"
,
"
url
"
:
gadget
.
state
.
store_new_image_cropped_method
,
...
...
@@ -203,9 +217,9 @@
})
.
push
(
function
(
evt
)
{
var
state_dict
=
{};
data
=
JSON
.
parse
(
evt
.
target
.
responseText
);
state_dict
[
'
blob_state_
'
+
blob_page
]
=
'
OK
'
;
state_dict
[
'
blob_uuid_
'
+
blob_page
]
=
data
.
uuid
;
state_dict
[
'
blob_uuid_
'
+
blob_page
]
=
JSON
.
parse
(
evt
.
target
.
responseText
).
uuid
;
return
gadget
.
changeState
(
state_dict
);
},
function
()
{
var
state_dict
=
{};
...
...
@@ -801,9 +815,6 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
canvas
=
gadget
.
cropper
.
getCroppedCanvas
(),
// XXX too slow, takes 2 seconds or more on mobile.
data_url
=
canvas
.
toDataURL
(
"
image/jpeg
"
,
0.85
);
state_dict
=
{
preferred_cropped_canvas_data
:
gadget
.
cropper
.
getData
(),
display_step
:
'
display_video
'
,
...
...
@@ -811,7 +822,8 @@
page_count
:
gadget
.
state
.
page_count
+
1
};
// Keep image date, as user may need to display it again
state_dict
[
'
blob_url_
'
+
gadget
.
state
.
page_count
]
=
data_url
;
state_dict
[
'
blob_canvas_
'
+
gadget
.
state
.
page_count
]
=
canvas
;
// state_dict['blob_url_' + gadget.state.page_count] = data_url;
state_dict
[
'
blob_state_
'
+
gadget
.
state
.
page_count
]
=
'
saving
'
;
state_dict
[
'
blob_uuid_
'
+
gadget
.
state
.
page_count
]
=
null
;
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
View file @
a06535ce
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
982.572
18.46980.24217
</string>
</value>
<value>
<string>
982.572
54.54695.8721
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
158558
2286.9
</float>
<float>
158558
4566.97
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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