kopia lustrzana https://github.com/backface/turtlestitch
integrated video capture control into global settings prims in Sensing
rodzic
33e1b858da
commit
6a65fa7c9c
|
|
@ -77,6 +77,9 @@
|
|||
* German
|
||||
* French
|
||||
|
||||
### 2019-05-08
|
||||
* Blocks, Objects, Threads: integrated video capture control into global settings prims in Sensing
|
||||
|
||||
### 2019-05-07
|
||||
* Blocks, Objects, Threads, Video: optimized video motion detection
|
||||
* Objects: actually stop the webcam, i.e. all tracks of the media stream when stopping video
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
<link rel="shortcut icon" href="src/favicon.ico">
|
||||
<script type="text/javascript" src="src/morphic.js?version=2019-02-07"></script>
|
||||
<script type="text/javascript" src="src/widgets.js?version=2019-04-05"></script>
|
||||
<script type="text/javascript" src="src/blocks.js?version=2019-05-07"></script>
|
||||
<script type="text/javascript" src="src/threads.js?version=2019-05-07"></script>
|
||||
<script type="text/javascript" src="src/objects.js?version=2019-05-07"></script>
|
||||
<script type="text/javascript" src="src/blocks.js?version=2019-05-08"></script>
|
||||
<script type="text/javascript" src="src/threads.js?version=2019-05-08"></script>
|
||||
<script type="text/javascript" src="src/objects.js?version=2019-05-08"></script>
|
||||
<script type="text/javascript" src="src/gui.js?version=2019-05-07"></script>
|
||||
<script type="text/javascript" src="src/paint.js?version=2019-02-22"></script>
|
||||
<script type="text/javascript" src="src/lists.js?version=2019-04-27"></script>
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.blocks = '2019-May-07';
|
||||
modules.blocks = '2019-May-08';
|
||||
|
||||
var SyntaxElementMorph;
|
||||
var BlockMorph;
|
||||
|
|
@ -1441,7 +1441,9 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
|
|||
false,
|
||||
{
|
||||
'turbo mode' : ['turbo mode'],
|
||||
'flat line ends' : ['flat line ends']
|
||||
'flat line ends' : ['flat line ends'],
|
||||
'video capture' : ['video capture'],
|
||||
'mirror video' : ['mirror video']
|
||||
},
|
||||
true
|
||||
);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize,
|
|||
TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph,
|
||||
AlignmentMorph, Process, XML_Element, VectorPaintEditorMorph*/
|
||||
|
||||
modules.objects = '2019-May-07';
|
||||
modules.objects = '2019-May-08';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
|
@ -1360,13 +1360,8 @@ SpriteMorph.prototype.initBlocks = function () {
|
|||
category: 'other',
|
||||
spec: 'code of %cmdRing'
|
||||
},
|
||||
|
||||
// Video motion
|
||||
doSetVideo: {
|
||||
type: 'command',
|
||||
category: 'sensing',
|
||||
spec: 'turn video %vid',
|
||||
defaults: ['on']
|
||||
},
|
||||
doSetVideoTransparency: {
|
||||
type: 'command',
|
||||
category: 'sensing',
|
||||
|
|
@ -2337,7 +2332,6 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
|||
blocks.push('-');
|
||||
|
||||
if (SpriteMorph.prototype.enableVideo) {
|
||||
blocks.push(block('doSetVideo'));
|
||||
blocks.push(block('doSetVideoTransparency'));
|
||||
blocks.push(block('reportMotionOn'));
|
||||
blocks.push('-');
|
||||
|
|
@ -7011,7 +7005,9 @@ StageMorph.prototype.init = function (globals) {
|
|||
|
||||
this.remixID = null;
|
||||
|
||||
// video motion detection, do not persist
|
||||
this.cameraCanvas = null;
|
||||
this.mirrorVideo = true;
|
||||
this.videoElement = null;
|
||||
this.videoTransparency = 50;
|
||||
this.videoMotion = null;
|
||||
|
|
@ -7274,7 +7270,7 @@ StageMorph.prototype.colorFiltered = function (aColor, excludedSprite) {
|
|||
return morph;
|
||||
};
|
||||
|
||||
StageMorph.prototype.startVideo = function(isFlipped) {
|
||||
StageMorph.prototype.startVideo = function() {
|
||||
var myself = this;
|
||||
|
||||
function noCameraSupport() {
|
||||
|
|
@ -7304,7 +7300,7 @@ StageMorph.prototype.startVideo = function(isFlipped) {
|
|||
this.videoElement.hidden = true;
|
||||
document.body.appendChild(this.videoElement);
|
||||
}
|
||||
this.videoElement.isFlipped = isFlipped;
|
||||
this.videoElement.isFlipped = !this.mirrorVideo;
|
||||
if (!this.videoMotion) {
|
||||
this.videoMotion = new VideoMotion(
|
||||
this.dimensions.x,
|
||||
|
|
@ -8056,7 +8052,6 @@ StageMorph.prototype.blockTemplates = function (category) {
|
|||
blocks.push('-');
|
||||
|
||||
if (SpriteMorph.prototype.enableVideo) {
|
||||
blocks.push(block('doSetVideo'));
|
||||
blocks.push(block('doSetVideoTransparency'));
|
||||
blocks.push(block('reportMotionOnStage'));
|
||||
blocks.push('-');
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
|
|||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, Color,
|
||||
TableFrameMorph, ColorSlotMorph, isSnapObject, Map, newCanvas, Symbol*/
|
||||
|
||||
modules.threads = '2019-May-07';
|
||||
modules.threads = '2019-May-08';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
|
@ -2021,23 +2021,46 @@ Process.prototype.reportIsFastTracking = function () {
|
|||
};
|
||||
|
||||
Process.prototype.doSetGlobalFlag = function (name, bool) {
|
||||
var stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
||||
name = this.inputOption(name);
|
||||
this.assertType(bool, 'Boolean');
|
||||
if (name === 'turbo mode') {
|
||||
switch (name) {
|
||||
case 'turbo mode':
|
||||
this.doSetFastTracking(bool);
|
||||
}
|
||||
if (name === 'flat line ends') {
|
||||
break;
|
||||
case 'flat line ends':
|
||||
SpriteMorph.prototype.useFlatLineEnds = bool;
|
||||
break;
|
||||
case 'video capture':
|
||||
if (bool) {
|
||||
stage.startVideo();
|
||||
} else {
|
||||
stage.stopVideo();
|
||||
}
|
||||
break;
|
||||
case 'mirror video':
|
||||
stage.mirrorVideo = bool;
|
||||
if (stage.videoElement) {
|
||||
stage.videoElement.isFlipped = !bool;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
Process.prototype.reportGlobalFlag = function (name) {
|
||||
var stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
||||
name = this.inputOption(name);
|
||||
if (name === 'turbo mode') {
|
||||
switch (name) {
|
||||
case 'turbo mode':
|
||||
return this.reportIsFastTracking();
|
||||
}
|
||||
if (name === 'flat line ends') {
|
||||
case 'flat line ends':
|
||||
return SpriteMorph.prototype.useFlatLineEnds;
|
||||
case 'video capture':
|
||||
return !isNil(stage.videoElement);
|
||||
case 'mirror video':
|
||||
return stage.mirrorVideo;
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue