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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
82b80334
Commit
82b80334
authored
Feb 17, 2020
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Optimize to reuse canvas
parent
043dd8fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
24 deletions
+27
-24
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_css.css
...eItem/web_page_module/rjs_gadget_document_scanner_css.css
+10
-0
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_css.xml
...eItem/web_page_module/rjs_gadget_document_scanner_css.xml
+2
-2
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
...ateItem/web_page_module/rjs_gadget_document_scanner_js.js
+13
-20
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
...teItem/web_page_module/rjs_gadget_document_scanner_js.xml
+2
-2
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_css.css
View file @
82b80334
...
...
@@ -100,4 +100,14 @@ div[data-gadget-url$="gadget_document_scanner.html"] .new-btn {
margin-left
:
0.2em
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.14
);
border-radius
:
0.325em
;
}
div
[
data-gadget-url
$
=
"gadget_document_scanner.html"
]
.img-container
{
/* Never limit the container height here */
max-width
:
100%
;
}
div
[
data-gadget-url
$
=
"gadget_document_scanner.html"
]
.img-container
img
{
/* This is important */
width
:
100%
;
}
\ No newline at end of file
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_css.xml
View file @
82b80334
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
981.5
7889.14448.17681
</string>
</value>
<value>
<string>
981.5
9690.60488.51404
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1581
863137.03
</float>
<float>
1581
971251.8
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
View file @
82b80334
...
...
@@ -309,31 +309,21 @@
return
image_capture
.
takePhoto
({
imageWidth
:
capabilities
.
imageWidth
.
max
});
})
.
push
(
function
(
blob
)
{
return
RSVP
.
all
([
createImageBitmap
(
blob
),
jIO
.
util
.
readBlobAsDataURL
(
blob
)
]);
return
createImageBitmap
(
blob
);
})
.
push
(
function
(
result_list
)
{
var
bitmap
=
result_list
[
0
],
canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
.
push
(
function
(
bitmap
)
{
var
canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
canvas
.
width
=
bitmap
.
width
;
canvas
.
height
=
bitmap
.
height
;
canvas
.
getContext
(
'
2d
'
).
drawImage
(
bitmap
,
0
,
0
);
return
[
canvas
,
result_list
[
1
].
target
.
result
];
})
.
push
(
function
(
result_list
)
{
var
new_canvas
,
canvas
=
result_list
[
0
],
data_url
=
result_list
[
1
];
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
if
(
settings
.
brightness
||
settings
.
contrast
||
settings
.
enable_greyscale
||
settings
.
compression
)
{
new_canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
return
new
RSVP
.
Queue
()
.
push
(
function
(
result
)
{
return
new
Promise
(
function
(
resolve
)
{
// XXX the correct usage is `new Caman()` but the library does not support it
caman
(
new_canvas
,
data_ur
l
,
function
()
{
caman
(
canvas
,
nul
l
,
function
()
{
if
(
settings
.
brightness
&&
settings
.
brightness
!==
0
)
{
this
.
brightness
(
settings
.
brightness
);
}
...
...
@@ -344,19 +334,22 @@
this
.
greyscale
();
}
this
.
render
(
function
()
{
resolve
(
new_canvas
);
resolve
(
[
this
.
context
.
canvas
,
settings
.
compression
]
);
});
});
});
});
}
return
canvas
;
return
[
canvas
,
settings
.
compression
]
;
})
.
push
(
function
(
canvas
)
{
.
push
(
function
(
result_list
)
{
var
canvas
=
result_list
[
0
],
compression
=
settings
.
compression
||
1
;
return
RSVP
.
all
([
gadget
.
getTranslationList
([
"
Delete
"
,
"
Save
"
]),
new
Promise
(
function
(
resolve
)
{
resolve
(
canvas
.
toDataURL
(
"
image/jpeg
"
));
resolve
(
canvas
.
toDataURL
(
"
image/jpeg
"
,
compression
));
}),
buildPreviousThumbnailDom
(
gadget
)
]);
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
View file @
82b80334
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
981.59
284.53554.54237
</string>
</value>
<value>
<string>
981.59
682.21065.57446
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
15819
47027.23
</float>
<float>
15819
70976.98
</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