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
07f61094
Commit
07f61094
authored
Feb 20, 2020
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: Improve code to switch cameras in mobiles with more than 2 cameras
parent
8608a1b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.js
...ateItem/web_page_module/rjs_gadget_document_scanner_js.js
+24
-6
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_js.js
View file @
07f61094
...
...
@@ -183,7 +183,7 @@
});
}
function
selectMediaDevice
(
current_device_id
,
force_new_device
)
{
function
selectMediaDevice
(
c
amera_list
,
c
urrent_device_id
,
force_new_device
)
{
return
getVideoDeviceList
()
.
push
(
function
(
info_list
)
{
var
j
,
...
...
@@ -193,12 +193,17 @@
device
=
info_list
[
j
];
if
(
device
.
kind
===
'
videoinput
'
)
{
if
((
!
current_device_id
)
||
(
camera_list
.
indexOf
(
device
.
deviceId
)
===
-
1
&&
(
force_new_device
&&
(
device
.
deviceId
!==
current_device_id
))
||
(
!
force_new_device
&&
(
device
.
deviceId
===
current_device_id
)))
{
(
!
force_new_device
&&
(
device
.
deviceId
===
current_device_id
)))
)
{
return
device
.
deviceId
;
}
}
}
if
(
len
>
0
)
{
return
info_list
[
0
].
deviceId
;
}
throw
new
Error
(
"
no media found
"
);
});
}
...
...
@@ -228,7 +233,6 @@
len
=
gadget
.
state
.
page_count
,
thumbnail_dom_list
=
[];
return
gadget
.
getTranslationList
([
"
Page
"
,
"
New Page
"
])
.
push
(
function
(
result_list
)
{
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
...
...
@@ -508,20 +512,27 @@
.
setState
({
display_step
:
'
display_video
'
,
page
:
1
,
page_count
:
0
page_count
:
0
,
camera_list
:
[]
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
// This method is called during the ERP5 form rendering
// changeState is used to ensure not resetting the gadget current display
// if not needed
var
gadget
=
this
,
camera_list
=
gadget
.
state
.
camera_list
,
default_value
=
JSON
.
parse
(
options
.
value
);
return
selectMediaDevice
(
gadget
.
state
.
device_id
,
false
)
return
selectMediaDevice
(
camera_list
,
gadget
.
state
.
device_id
,
false
)
.
push
(
function
(
device_id
)
{
if
(
camera_list
.
indexOf
(
device_id
)
===
-
1
)
{
camera_list
.
push
(
device_id
);
}
return
gadget
.
changeState
({
store_new_image_cropped_method
:
options
.
store_new_image_cropped_method
,
active_process
:
default_value
.
active_process
,
image_list
:
default_value
.
image_list
,
camera_list
:
camera_list
,
preferred_cropped_canvas_data
:
JSON
.
parse
(
options
.
preferred_cropped_canvas_data
),
preferred_image_settings_data
:
JSON
.
parse
(
options
.
preferred_image_settings_data
),
device_id
:
device_id
,
...
...
@@ -666,11 +677,18 @@
}
if
(
evt
.
target
.
className
.
indexOf
(
"
change-camera-btn
"
)
!==
-
1
)
{
return
selectMediaDevice
(
gadget
.
state
.
device_id
,
true
)
return
selectMediaDevice
(
gadget
.
state
.
camera_list
,
gadget
.
state
.
device_id
,
true
)
.
push
(
function
(
device_id
)
{
var
camera_list
=
gadget
.
state
.
camera_list
;
if
(
camera_list
.
indexOf
(
device_id
)
===
-
1
)
{
camera_list
.
push
(
device_id
);
}
else
{
camera_list
=
[
device_id
];
}
return
gadget
.
changeState
({
display_step
:
'
display_video
'
,
preferred_cropped_canvas_data
:
{},
camera_list
:
camera_list
,
device_id
:
device_id
});
});
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/rjs_gadget_document_scanner_js.xml
View file @
07f61094
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
981.6
2898.35786.34542
</string>
</value>
<value>
<string>
981.6
3771.9766.25975
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1582
163875.18
</float>
<float>
1582
221430.61
</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