disable camera because of retina issues

(but make it accessible as hidden setting while we’re working on it)
upd4.1
Jens Mönig 2017-09-14 15:34:44 +02:00
rodzic ba9a7bd6f6
commit 5516f93da5
2 zmienionych plików z 92 dodań i 70 usunięć

158
gui.js
Wyświetl plik

@ -75,7 +75,7 @@ isRetinaSupported, SliderMorph, Animation*/
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.gui = '2017-September-08'; modules.gui = '2017-September-14';
// Declarations // Declarations
@ -1484,45 +1484,44 @@ IDE_Morph.prototype.createCorralBar = function () {
); );
this.corralBar.add(paintbutton); this.corralBar.add(paintbutton);
cambutton = new PushButtonMorph( if (CamSnapshotDialogMorph.prototype.enableCamera) {
this, cambutton = new PushButtonMorph(
"newCamSprite", this,
new SymbolMorph("camera", 15) "newCamSprite",
); new SymbolMorph("camera", 15)
);
cambutton.corner = 12; cambutton.corner = 12;
cambutton.color = colors[0]; cambutton.color = colors[0];
cambutton.highlightColor = colors[1]; cambutton.highlightColor = colors[1];
cambutton.pressColor = colors[2]; cambutton.pressColor = colors[2];
cambutton.labelMinExtent = new Point(36, 18); cambutton.labelMinExtent = new Point(36, 18);
cambutton.padding = 0; cambutton.padding = 0;
cambutton.labelShadowOffset = new Point(-1, -1); cambutton.labelShadowOffset = new Point(-1, -1);
cambutton.labelShadowColor = colors[1]; cambutton.labelShadowColor = colors[1];
cambutton.labelColor = this.buttonLabelColor; cambutton.labelColor = this.buttonLabelColor;
cambutton.contrast = this.buttonContrast; cambutton.contrast = this.buttonContrast;
cambutton.drawNew(); cambutton.drawNew();
cambutton.hint = "take a camera snapshot and\nimport it as a new sprite"; cambutton.hint = "take a camera snapshot and\nimport it as a new sprite";
cambutton.fixLayout(); cambutton.fixLayout();
cambutton.setCenter(this.corralBar.center()); cambutton.setCenter(this.corralBar.center());
cambutton.setLeft( cambutton.setLeft(
this.corralBar.left() + this.corralBar.left() +
padding + padding +
newbutton.width() + newbutton.width() +
padding + padding +
paintbutton.width() + paintbutton.width() +
padding padding
); );
if (location.protocol === 'http:') {
if (location.protocol === 'http:') { cambutton.hint = 'Due to browser security policies, you need to\n' +
cambutton.hint = 'Due to browser security policies, you need to\n' + 'access Snap! through HTTPS to use the camera.\n\n' +
'access Snap! through HTTPS to use the camera.\n\n' + 'Plase replace the "http://" part of the address\n' +
'Plase replace the "http://" part of the address\n' + 'in your browser by "https://" and try again.';
'in your browser by "https://" and try again.'; cambutton.disable();
cambutton.disable(); }
this.corralBar.add(cambutton);
} }
this.corralBar.add(cambutton);
}; };
IDE_Morph.prototype.createCorral = function () { IDE_Morph.prototype.createCorral = function () {
@ -1920,6 +1919,14 @@ IDE_Morph.prototype.toggleSingleStepping = function () {
this.controlBar.refreshSlider(); this.controlBar.refreshSlider();
}; };
IDE_Morph.prototype.toggleCameraSupport = function () {
CamSnapshotDialogMorph.prototype.enableCamera =
!CamSnapshotDialogMorph.prototype.enableCamera;
this.spriteBar.tabBar.tabTo(this.currentTab);
this.createCorralBar();
this.fixLayout();
};
IDE_Morph.prototype.startFastTracking = function () { IDE_Morph.prototype.startFastTracking = function () {
this.stage.isFastTracked = true; this.stage.isFastTracked = true;
this.stage.fps = 0; this.stage.fps = 0;
@ -2570,6 +2577,14 @@ IDE_Morph.prototype.settingsMenu = function () {
'check to turn on\n visible stepping (slow)', 'check to turn on\n visible stepping (slow)',
false false
); );
addPreference(
'Camera support',
'toggleCameraSupport',
CamSnapshotDialogMorph.prototype.enableCamera,
'uncheck to disable\ncamera support',
'check to enable\ncamera support',
true
);
menu.addLine(); // everything visible below is persistent menu.addLine(); // everything visible below is persistent
addPreference( addPreference(
'Blurred shadows', 'Blurred shadows',
@ -7293,8 +7308,9 @@ CostumeIconMorph.prototype.duplicateCostume = function () {
CostumeIconMorph.prototype.removeCostume = function () { CostumeIconMorph.prototype.removeCostume = function () {
var wardrobe = this.parentThatIsA(WardrobeMorph), var wardrobe = this.parentThatIsA(WardrobeMorph),
idx = this.parent.children.indexOf(this), idx = this.parent.children.indexOf(this),
off = CamSnapshotDialogMorph.prototype.enableCamera ? 3 : 2,
ide = this.parentThatIsA(IDE_Morph); ide = this.parentThatIsA(IDE_Morph);
wardrobe.removeCostumeAt(idx - 3); // ignore the paintbrush and camera buttons wardrobe.removeCostumeAt(idx - off); // ignore paintbrush and camera buttons
if (ide.currentSprite.costume === this.object) { if (ide.currentSprite.costume === this.object) {
ide.currentSprite.wearCostume(null); ide.currentSprite.wearCostume(null);
} }
@ -7612,38 +7628,38 @@ WardrobeMorph.prototype.updateList = function () {
this.addContents(paintbutton); this.addContents(paintbutton);
cambutton = new PushButtonMorph( if (CamSnapshotDialogMorph.prototype.enableCamera) {
this, cambutton = new PushButtonMorph(
"newFromCam", this,
new SymbolMorph("camera", 15) "newFromCam",
); new SymbolMorph("camera", 15)
cambutton.padding = 0; );
cambutton.corner = 12; cambutton.padding = 0;
cambutton.color = IDE_Morph.prototype.groupColor; cambutton.corner = 12;
cambutton.highlightColor = IDE_Morph.prototype.frameColor.darker(50); cambutton.color = IDE_Morph.prototype.groupColor;
cambutton.pressColor = paintbutton.highlightColor; cambutton.highlightColor = IDE_Morph.prototype.frameColor.darker(50);
cambutton.labelMinExtent = new Point(36, 18); cambutton.pressColor = paintbutton.highlightColor;
cambutton.labelShadowOffset = new Point(-1, -1); cambutton.labelMinExtent = new Point(36, 18);
cambutton.labelShadowColor = paintbutton.highlightColor; cambutton.labelShadowOffset = new Point(-1, -1);
cambutton.labelColor = TurtleIconMorph.prototype.labelColor; cambutton.labelShadowColor = paintbutton.highlightColor;
cambutton.contrast = this.buttonContrast; cambutton.labelColor = TurtleIconMorph.prototype.labelColor;
cambutton.drawNew(); cambutton.contrast = this.buttonContrast;
cambutton.hint = "Import a new costume from your webcam"; cambutton.drawNew();
cambutton.setPosition(new Point(x, y)); cambutton.hint = "Import a new costume from your webcam";
cambutton.fixLayout(); cambutton.setPosition(new Point(x, y));
cambutton.setCenter(paintbutton.center()); cambutton.fixLayout();
cambutton.setLeft(paintbutton.right() + toolsPadding); cambutton.setCenter(paintbutton.center());
cambutton.setLeft(paintbutton.right() + toolsPadding);
if (location.protocol === 'http:') { if (location.protocol === 'http:') {
cambutton.hint = 'Due to browser security policies, you need to\n' + cambutton.hint = 'Due to browser security policies, you need to\n' +
'access Snap! through HTTPS to use the camera.\n\n' + 'access Snap! through HTTPS to use the camera.\n\n' +
'Plase replace the "http://" part of the address\n' + 'Plase replace the "http://" part of the address\n' +
'in your browser by "https://" and try again.'; 'in your browser by "https://" and try again.';
cambutton.disable(); cambutton.disable();
}
this.addContents(cambutton);
} }
this.addContents(cambutton);
txt = new TextMorph(localize( txt = new TextMorph(localize(
"costumes tab help" // look up long string in translator "costumes tab help" // look up long string in translator
)); ));
@ -8341,11 +8357,13 @@ PaletteHandleMorph.prototype.mouseDoubleClick = function () {
/* /*
I am a dialog morph that lets users take a snapshot using their webcam I am a dialog morph that lets users take a snapshot using their webcam
and use it as a costume for their sprites or a background for the Stage. and use it as a costume for their sprites or a background for the Stage.
NOTE: Currently disabled because of issues with retina displays.
*/ */
// CamSnapshotDialogMorph inherits from DialogBoxMorph: // CamSnapshotDialogMorph inherits from DialogBoxMorph:
CamSnapshotDialogMorph.prototype.enableCamera = false; // has issues with retina
CamSnapshotDialogMorph.prototype = new DialogBoxMorph(); CamSnapshotDialogMorph.prototype = new DialogBoxMorph();
CamSnapshotDialogMorph.prototype.constructor = CamSnapshotDialogMorph; CamSnapshotDialogMorph.prototype.constructor = CamSnapshotDialogMorph;
CamSnapshotDialogMorph.uber = DialogBoxMorph.prototype; CamSnapshotDialogMorph.uber = DialogBoxMorph.prototype;

Wyświetl plik

@ -3619,6 +3619,10 @@ Fixes:
------ ------
* GUI, Objects, Widgets, Symbols: Camera Snapshot Dialog. Thank you, Bernat!! * GUI, Objects, Widgets, Symbols: Camera Snapshot Dialog. Thank you, Bernat!!
170914
------
* GUI: disable camera (but make it accessible as hidden setting) because of retina issues
v4.1 Features: v4.1 Features:
* polymorphic sprite-local custom blocks * polymorphic sprite-local custom blocks