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 {
...
@@ -100,4 +100,14 @@ div[data-gadget-url$="gadget_document_scanner.html"] .new-btn {
margin-left
:
0.2em
;
margin-left
:
0.2em
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.14
);
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.14
);
border-radius
:
0.325em
;
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 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1581
863137.03
</float>
<float>
1581
971251.8
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
View file @
82b80334
...
@@ -309,31 +309,21 @@
...
@@ -309,31 +309,21 @@
return
image_capture
.
takePhoto
({
imageWidth
:
capabilities
.
imageWidth
.
max
});
return
image_capture
.
takePhoto
({
imageWidth
:
capabilities
.
imageWidth
.
max
});
})
})
.
push
(
function
(
blob
)
{
.
push
(
function
(
blob
)
{
return
RSVP
.
all
([
return
createImageBitmap
(
blob
);
createImageBitmap
(
blob
),
jIO
.
util
.
readBlobAsDataURL
(
blob
)
]);
})
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
bitmap
)
{
var
bitmap
=
result_list
[
0
],
var
canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
canvas
.
width
=
bitmap
.
width
;
canvas
.
width
=
bitmap
.
width
;
canvas
.
height
=
bitmap
.
height
;
canvas
.
height
=
bitmap
.
height
;
canvas
.
getContext
(
'
2d
'
).
drawImage
(
bitmap
,
0
,
0
);
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
)
{
if
(
settings
.
brightness
||
settings
.
contrast
||
settings
.
enable_greyscale
||
settings
.
compression
)
{
new_canvas
=
domsugar
(
'
canvas
'
,
{
'
class
'
:
'
canvas
'
});
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
return
new
Promise
(
function
(
resolve
)
{
return
new
Promise
(
function
(
resolve
)
{
// XXX the correct usage is `new Caman()` but the library does not support it
// 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
)
{
if
(
settings
.
brightness
&&
settings
.
brightness
!==
0
)
{
this
.
brightness
(
settings
.
brightness
);
this
.
brightness
(
settings
.
brightness
);
}
}
...
@@ -344,19 +334,22 @@
...
@@ -344,19 +334,22 @@
this
.
greyscale
();
this
.
greyscale
();
}
}
this
.
render
(
function
()
{
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
([
return
RSVP
.
all
([
gadget
.
getTranslationList
([
"
Delete
"
,
"
Save
"
]),
gadget
.
getTranslationList
([
"
Delete
"
,
"
Save
"
]),
new
Promise
(
function
(
resolve
)
{
new
Promise
(
function
(
resolve
)
{
resolve
(
canvas
.
toDataURL
(
"
image/jpeg
"
));
resolve
(
canvas
.
toDataURL
(
"
image/jpeg
"
,
compression
));
}),
}),
buildPreviousThumbnailDom
(
gadget
)
buildPreviousThumbnailDom
(
gadget
)
]);
]);
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
View file @
82b80334
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15819
47027.23
</float>
<float>
15819
70976.98
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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