File tree 3 files changed +9
-9
lines changed
3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " node-red-node-ui-webcam" ,
3
- "version" : " 0.2.0 " ,
3
+ "version" : " 0.2.1 " ,
4
4
"description" : " A Node-RED ui node to capture images from a webcam." ,
5
5
"author" : " Nick O'Leary" ,
6
6
"license" : " Apache-2.0" ,
Original file line number Diff line number Diff line change 16
16
category : 'dashboard' ,
17
17
color : 'rgb( 63, 173, 181)' ,
18
18
defaults : {
19
+ name : { value : '' } ,
19
20
group : { type : 'ui_group' , required :true } ,
20
21
order : { value : 0 } ,
21
22
width : {
29
30
$ ( "#node-input-size" ) . toggleClass ( "input-error" , ! valid ) ;
30
31
return valid ;
31
32
} } ,
32
- height : { value : 0 } ,
33
- name : { value : '' } ,
33
+ height : { value : 5 } ,
34
34
countdown : { value : false } ,
35
35
autoStart : { value : false } ,
36
36
hideCaptureButton : { value : false } ,
87
87
} )
88
88
89
89
$ ( "#node-input-showImage-enable" ) . trigger ( "change" ) ;
90
-
91
90
} ,
92
91
oneditsave : function ( ) {
93
92
var showImageEnable = $ ( "#node-input-showImage-enable" ) [ 0 ] . checked ;
101
100
} else {
102
101
this . showImage = showImageTime ;
103
102
}
104
-
105
103
}
106
104
} ) ;
107
105
</ script >
154
152
</ select >
155
153
</ div >
156
154
</ div >
157
-
158
155
</ div >
159
156
< div class = "form-row" >
160
157
< label for = "node-input-name" > < i class = "icon-tag" > </ i > Name</ label >
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ module.exports = function(RED) {
42
42
position: absolute;
43
43
width: 100%;
44
44
height: 100%;
45
+ -webkit-transform: scaleX(-1);
46
+ transform: scaleX(-1);
45
47
}
46
48
.ui-webcam-playback-container {
47
49
width: 100%;
@@ -211,8 +213,6 @@ module.exports = function(RED) {
211
213
var activeCamera = null ;
212
214
var oldActiveCamera = null ;
213
215
214
-
215
-
216
216
$scope . changeCamera = function ( deviceId ) {
217
217
oldActiveCamera = activeCamera ;
218
218
activeCamera = $scope . data . cameras [ deviceId ] . deviceId ;
@@ -325,7 +325,10 @@ module.exports = function(RED) {
325
325
var canvas = document . querySelector ( "canvas#ui_webcam_canvas_" + $scope . $id ) ;
326
326
canvas . width = playbackEl . videoWidth ;
327
327
canvas . height = playbackEl . videoHeight ;
328
- canvas . getContext ( '2d' ) . drawImage ( playbackEl , 0 , 0 ) ;
328
+ var ctx = canvas . getContext ( '2d' ) ;
329
+ ctx . translate ( playbackEl . videoWidth , 0 ) ;
330
+ ctx . scale ( - 1 , 1 ) ;
331
+ ctx . drawImage ( playbackEl , 0 , 0 ) ;
329
332
var img = document . querySelector ( "img#ui_webcam_image_" + $scope . $id ) ;
330
333
img . src = canvas . toDataURL ( 'image/' + ( $scope . config . format || 'png' ) ) ;
331
334
if ( $scope . config . showImage ) {
You can’t perform that action at this time.
0 commit comments