Commit 4e51d64c authored by Romain Courteaud's avatar Romain Courteaud

erp5_document_scanner: unify video and cropper rendering

parent 2febf23a
...@@ -20,7 +20,7 @@ div[data-gadget-url$="gadget_document_scanner.html"] .canvas { ...@@ -20,7 +20,7 @@ div[data-gadget-url$="gadget_document_scanner.html"] .canvas {
text-align: center; text-align: center;
} }
div[data-gadget-url$="gadget_document_scanner.html"] .camera-input { div[data-gadget-url$="gadget_document_scanner.html"] .camera-input {
min-height: 360px; background-color: rgba(0, 0, 0, 0.5);
} }
div[data-gadget-url$="gadget_document_scanner.html"] .page-number { div[data-gadget-url$="gadget_document_scanner.html"] .page-number {
display: inline; display: inline;
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.61113.55569.43315</string> </value> <value> <string>982.60162.8290.29303</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>1585816780.79</float> <float>1585815950.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -191,10 +191,9 @@ ...@@ -191,10 +191,9 @@
guides: true, guides: true,
center: true, center: true,
background: false, background: false,
minContainerWidth: 1, minContainerWidth: 0,
minContainerHeight: 1, minContainerHeight: 0,
responsive: true, responsive: false,
restore: true,
// Avoid any cropper calculation or guessing // Avoid any cropper calculation or guessing
scalable: false, scalable: false,
rotatable: false, rotatable: false,
...@@ -430,11 +429,14 @@ ...@@ -430,11 +429,14 @@
text: result_list[1][0] text: result_list[1][0]
})); }));
button_list.push( if (gadget.state.is_cropper_size_confirmed) {
domsugar('button', {type: 'button', button_list.push(
'class': 'auto-crop-btn ui-icon-fast-forward ui-btn-icon-left', domsugar('button', {type: 'button',
text: result_list[1][3] 'class': 'auto-crop-btn ui-icon-fast-forward ui-btn-icon-left',
})); text: result_list[1][3]
})
);
}
div = domsugar('div', {'class': 'camera'}, [ div = domsugar('div', {'class': 'camera'}, [
domsugar('div', {'class': 'camera-header'}, [ domsugar('div', {'class': 'camera-header'}, [
...@@ -720,9 +722,7 @@ ...@@ -720,9 +722,7 @@
domsugar('label', {'class': 'page-number', text: gadget.state.page + 1}) domsugar('label', {'class': 'page-number', text: gadget.state.page + 1})
]) ])
]), ]),
domsugar('div', {'class': 'img-container'}, [ domsugar('img', {src: gadget.state['blob_url_' + gadget.state.page]}),
domsugar('img', {src: gadget.state['blob_url_' + gadget.state.page]})
]),
// XXX TODO: why is the button rendering different from the other pages? // XXX TODO: why is the button rendering different from the other pages?
domsugar('div', {'class': 'edit-picture'}, button_list), domsugar('div', {'class': 'edit-picture'}, button_list),
result_list[1] result_list[1]
...@@ -742,7 +742,8 @@ ...@@ -742,7 +742,8 @@
preferred_cropped_canvas_data: gadget.cropper.getData(), preferred_cropped_canvas_data: gadget.cropper.getData(),
display_step: 'display_video', display_step: 'display_video',
page: gadget.state.page + 1, page: gadget.state.page + 1,
page_count: gadget.state.page_count + 1 page_count: gadget.state.page_count + 1,
is_cropper_size_confirmed: true
}; };
// Keep image date, as user may need to display it again // Keep image date, as user may need to display it again
state_dict['blob_canvas_' + gadget.state.page_count] = canvas; state_dict['blob_canvas_' + gadget.state.page_count] = canvas;
...@@ -788,7 +789,8 @@ ...@@ -788,7 +789,8 @@
display_step: 'display_video', display_step: 'display_video',
page: 1, page: 1,
page_count: 0, page_count: 0,
camera_list: [] camera_list: [],
is_cropper_size_confirmed: false
}) })
.declareMethod('render', function (options) { .declareMethod('render', function (options) {
// This method is called during the ERP5 form rendering // This method is called during the ERP5 form rendering
......
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>982.61614.28913.46660</string> </value> <value> <string>982.61109.60561.44919</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>1585846471.58</float> <float>1585815745.95</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -19,7 +19,8 @@ div[data-gadget-url$="gadget_document_scanner.html"] { ...@@ -19,7 +19,8 @@ div[data-gadget-url$="gadget_document_scanner.html"] {
} }
.camera-input { .camera-input {
min-height: 360px; // Mimic cropper background
background-color: rgba(0, 0, 0, 0.5);
} }
.page-number { .page-number {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment