proxied thumbnail, name and notes in project, restored in XML

snap7
jmoenig 2021-05-21 00:08:24 +02:00
rodzic ae13edd984
commit 498c4c8edf
5 zmienionych plików z 45 dodań i 21 usunięć

Wyświetl plik

@ -8,6 +8,9 @@
* **Notable Fixes:**
* made scrollbars in the wardrobe and jukebox more responsive
### 2021-05-21
* gui, scenes, store: proxied thumbnail, name and notes in project, restored in XML
### 2021-05-20
* gui: marked projectName to be refactored and sceneified

Wyświetl plik

@ -11,8 +11,8 @@
<script src="src/blocks.js?version=2021-04-12"></script>
<script src="src/threads.js?version=2021-04-17"></script>
<script src="src/objects.js?version=2021-04-23"></script>
<script src="src/scenes.js?version=2021-05-19"></script>
<script src="src/gui.js?version=2021-05-20"></script>
<script src="src/scenes.js?version=2021-05-21"></script>
<script src="src/gui.js?version=2021-05-21"></script>
<script src="src/paint.js?version=2021-03-17"></script>
<script src="src/lists.js?version=2021-03-15"></script>
<script src="src/byob.js?version=2021-05-04"></script>
@ -21,7 +21,7 @@
<script src="src/video.js?version=2019-06-27"></script>
<script src="src/maps.js?version=2020-03-25"></script>
<script src="src/xml.js?version=2020-04-27"></script>
<script src="src/store.js?version=2021-05-19"></script>
<script src="src/store.js?version=2021-05-21"></script>
<script src="src/locale.js?version=2021-03-15"></script>
<script src="src/cloud.js?version=2021-02-04"></script>
<script src="src/api.js?version=2021-01-25"></script>

Wyświetl plik

@ -68,7 +68,7 @@
/*global modules, Morph, SpriteMorph, SyntaxElementMorph, Color, Cloud, Audio,
ListWatcherMorph, TextMorph, newCanvas, useBlurredShadows, Sound, Scene, Note,
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph, normalizeCanvas,
StringMorph, Point, MenuMorph, morphicVersion, DialogBoxMorph, BlockEditorMorph,
ToggleButtonMorph, contains, ScrollFrameMorph, StageMorph, PushButtonMorph, sb,
InputFieldMorph, FrameMorph, Process, nop, SnapSerializer, ListMorph, detect,
AlignmentMorph, TabMorph, Costume, MorphicPreferences,BlockMorph, ToggleMorph,
@ -79,11 +79,11 @@ CommandBlockMorph, BooleanSlotMorph, RingReporterSlotMorph, ScriptFocusMorph,
BlockLabelPlaceHolderMorph, SpeechBubbleMorph, XML_Element, WatcherMorph, WHITE,
BlockRemovalDialogMorph,TableMorph, isSnapObject, isRetinaEnabled, SliderMorph,
disableRetinaSupport, enableRetinaSupport, isRetinaSupported, MediaRecorder,
Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Project, ZERO, BLACK*/
Animation, BoxMorph, BlockDialogMorph, Project, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2021-May-20';
modules.gui = '2021-May-21';
// Declarations
@ -4760,7 +4760,7 @@ IDE_Morph.prototype.exportProject = function (name, plain) {
// newWindow requests displaying the project in a new tab.
var menu, str, dataPrefix;
name = this.scenes.at(1).name; // +++
name = this.scenes.at(1).name; // +++++
if (name) {
this.setProjectName(name);
@ -6546,25 +6546,22 @@ IDE_Morph.prototype.logout = function () {
};
IDE_Morph.prototype.buildProjectRequest = function () {
var thumbnail = normalizeCanvas(
this.stage.thumbnail(
SnapSerializer.prototype.thumbnailSize
)).toDataURL(),
var proj = new Project(this.scenes, this.scene),
body,
xml;
this.serializer.isCollectingMedia = true;
xml = this.serializer.serialize(new Project(this.scenes, this.scene));
xml = this.serializer.serialize(proj);
body = {
notes: this.projectNotes,
notes: proj.notes,
xml: xml,
/*
media: this.hasChangedMedia ? // incremental media upload, disabled
this.serializer.mediaXML(this.projectName) : null,
this.serializer.mediaXML(proj.name) : null,
*/
media: this.serializer.mediaXML(this.projectName),
thumbnail: thumbnail,
remixID: this.stage.remixID
media: this.serializer.mediaXML(proj.name),
thumbnail: proj.thumbnail.toDataURL(),
remixID: this.stage.remixID // +++ sceneify remixID
};
this.serializer.isCollectingMedia = false;
this.serializer.flushMedia();

Wyświetl plik

@ -48,9 +48,10 @@
// Global stuff ////////////////////////////////////////////////////////
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List*/
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List,
normalizeCanvas, SnapSerializer*/
modules.scenes = '2021-May-19';
modules.scenes = '2021-May-21';
// Projecct /////////////////////////////////////////////////////////
@ -67,8 +68,18 @@ function Project(scenes, current) {
this.currentScene = current;
// proxied for display
this.name = null;
this.notes = null;
this.thumbnail = null;
projectScene = this.scenes.at(1);
this.name = projectScene ? projectScene.name : null;
if (projectScene) {
this.name = projectScene.name;
this.notes = projectScene.notes;
this.thumbnail = normalizeCanvas(
projectScene.stage.thumbnail(SnapSerializer.prototype.thumbnailSize)
);
}
// for deserializing - do not persist
this.sceneIdx = null;

Wyświetl plik

@ -61,7 +61,7 @@ Project*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2021-May-19';
modules.store = '2021-May-21';
// XML_Serializer ///////////////////////////////////////////////////////
@ -1642,13 +1642,26 @@ Array.prototype.toXML = function (serializer) {
// Scenes & multi-scene projects
Project.prototype.toXML = function (serializer) {
var thumbdata;
// thumb data catch cross-origin tainting exception when using SVG costumes
try {
thumbdata = this.thumbnail.toDataURL('image/png');
} catch (error) {
thumbdata = null;
}
return serializer.format(
'<project name="@" app="@" version="@">' +
'<notes>$</notes>' +
'<thumbnail>$</thumbnail>' +
'<scenes select="@">%</scenes>' +
'</project>',
this.name || localize('Untitled'),
serializer.app,
serializer.version,
this.notes || '',
thumbdata,
this.scenes.asArray().indexOf(
this.currentScene) + 1,
serializer.store(this.scenes.itemsArray())