mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
make pixel-input stream aware of area
This commit is contained in:
+23
-1
@@ -24,7 +24,9 @@ define(function() {
|
||||
calculatedWidth,
|
||||
calculatedHeight,
|
||||
_eventNames = ['canrecord', 'ended'],
|
||||
_eventHandlers = {};
|
||||
_eventHandlers = {},
|
||||
_topRight = {x: 0, y: 0},
|
||||
_canvasSize = {x: 0, y: 0};
|
||||
|
||||
function loadImages() {
|
||||
loaded = false;
|
||||
@@ -41,6 +43,8 @@ define(function() {
|
||||
calculatedWidth = _config.size ? width/height > 1 ? _config.size : Math.floor((width/height) * _config.size) : width;
|
||||
calculatedHeight = _config.size ? width/height > 1 ? Math.floor((height/width) * _config.size) : _config.size : height;
|
||||
|
||||
_canvasSize.x = calculatedWidth;
|
||||
_canvasSize.y = calculatedHeight;
|
||||
|
||||
setTimeout(function() {
|
||||
publishEvent("canrecord", []);
|
||||
@@ -124,6 +128,24 @@ define(function() {
|
||||
}
|
||||
};
|
||||
|
||||
that.setTopRight = function(topRight) {
|
||||
_topRight.x = topRight.x;
|
||||
_topRight.y = topRight.y;
|
||||
};
|
||||
|
||||
that.getTopRight = function() {
|
||||
return _topRight;
|
||||
};
|
||||
|
||||
that.setCanvasSize = function(size) {
|
||||
_canvasSize.x = size.x;
|
||||
_canvasSize.y = size.y;
|
||||
};
|
||||
|
||||
that.getCanvasSize = function() {
|
||||
return _canvasSize;
|
||||
};
|
||||
|
||||
that.getFrame = function() {
|
||||
if (!loaded){
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user