Export picture of all scripts

* new entry in the ScriptsMorph's userMenu lets you export a picture of
all scripts, including comments.

* place sticky comments on World layer on dragging their anchor block,
fixes both #8 and #18

* additional settings for developing the backend
pull/3/merge
jmoenig 2013-04-17 17:28:49 +02:00
rodzic 15718f44a3
commit 06d35dae6c
4 zmienionych plików z 48 dodań i 4 usunięć

Wyświetl plik

@ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2013-April-05';
modules.blocks = '2013-April-17';
var SyntaxElementMorph;
var BlockMorph;
@ -4285,6 +4285,11 @@ ScriptsMorph.prototype.userMenu = function () {
}
menu.addItem('clean up', 'cleanUp', 'arrange scripts\nvertically');
menu.addItem('add comment', 'addComment');
menu.addItem(
'scripts pic...',
'exportScriptsPicture',
'open a new window\nwith a picture of all scripts'
);
if (ide) {
menu.addLine();
menu.addItem(
@ -4343,6 +4348,29 @@ ScriptsMorph.prototype.cleanUp = function () {
this.adjustBounds();
};
ScriptsMorph.prototype.exportScriptsPicture = function () {
var boundingBox, pic, ctx;
if (this.children.length === 0) {return; }
boundingBox = this.children[0].fullBounds();
this.children.forEach(function (child) {
if (child.isVisible) {
boundingBox = boundingBox.merge(child.fullBounds());
}
});
pic = newCanvas(boundingBox.extent());
ctx = pic.getContext('2d');
this.children.forEach(function (child) {
var pos = child.position();
if (child.isVisible) {
ctx.drawImage(
child.fullImageClassic(),
pos.x - boundingBox.origin.x,
pos.y - boundingBox.origin.y
);
}
});
window.open(pic.toDataURL());
};
ScriptsMorph.prototype.addComment = function () {
new CommentMorph().pickUp(this.world());
@ -9057,6 +9085,7 @@ CommentMorph.prototype.align = function (topBlock, ignoreLayer) {
CommentMorph.prototype.startFollowing = function (topBlock) {
var myself = this;
this.align(topBlock);
this.world().add(this);
this.addShadow();
this.stickyOffset = this.position().subtract(this.block.position());
this.step = function () {

Wyświetl plik

@ -29,7 +29,7 @@
/*global modules, IDE_Morph, SnapSerializer, hex_sha512, alert, nop*/
modules.cloud = '2013-April-08';
modules.cloud = '2013-April-17';
// Global stuff
@ -38,6 +38,7 @@ var Cloud;
var SnapCloud = new Cloud(
'https://snapcloud.miosoft.com/miocon/app/login?_app=SnapCloud'
//'192.168.2.108:8087/miocon/app/login?_app=SnapCloud'
//'192.168.186.167:8087/miocon/app/login?_app=SnapCloud'
// 'localhost/miocon/app/login?_app=SnapCloud'
);

6
gui.js
Wyświetl plik

@ -68,7 +68,7 @@ sb, CommentMorph, CommandBlockMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2013-April-12';
modules.gui = '2013-April-17';
// Declarations
@ -3343,8 +3343,10 @@ IDE_Morph.prototype.setCloudURL = function () {
'Snap!Cloud' :
'https://snapcloud.miosoft.com/miocon/app/' +
'login?_app=SnapCloud',
'local network dev' :
'local network lab' :
'192.168.2.108:8087/miocon/app/login?_app=SnapCloud',
'local network office' :
'192.168.186.167:8087/miocon/app/login?_app=SnapCloud',
'localhost dev' :
'localhost/miocon/app/login?_app=SnapCloud'
}

Wyświetl plik

@ -1623,3 +1623,15 @@ ______
* Lists: fix for typecasting bug in CONTAINS
* BYOB: Tooltips for custom block templates (sitting in the palette): mousing over a custom block in the palette pops up its definition hat comment in a comment-colored speech bubble
* GUI: Sharing/Unsharing/Deleting now available in all version of the project dialog
130415
------
* Blocks: place sticky comments on World layer on dragging their anchor block
130416
------
* Cloud, GUI: additional dev settings
130417
------
* Blocks: "scripts pic" option in the ScriptsMorph's userMenu lets you export a picture of all scripts (including comments)