kopia lustrzana https://github.com/backface/turtlestitch
added infrastructure for hiding individual variables in palette
rodzic
cc5412a89e
commit
28c66fb411
|
@ -37,6 +37,9 @@
|
|||
* German
|
||||
* Chinese, thanks, Simon!
|
||||
|
||||
### 2021-10-05
|
||||
* threads, store: added infrastructure for hiding individual variables in palette
|
||||
|
||||
### 2021-10-04
|
||||
* blocks: added "enter" key to key-pressed dropdown
|
||||
* updated German translation for "enter" key
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<script src="src/symbols.js?version=2021-03-03"></script>
|
||||
<script src="src/widgets.js?version=2021-07-21"></script>
|
||||
<script src="src/blocks.js?version=2021-10-04"></script>
|
||||
<script src="src/threads.js?version=2021-10-04"></script>
|
||||
<script src="src/threads.js?version=2021-10-05"></script>
|
||||
<script src="src/objects.js?version=2021-10-04"></script>
|
||||
<script src="src/scenes.js?version=2021-07-21"></script>
|
||||
<script src="src/gui.js?version=2021-09-30"></script>
|
||||
|
@ -30,7 +30,7 @@
|
|||
<script src="src/maps.js?version=2021-06-15"></script>
|
||||
<script src="src/extensions.js?version=2021-08-03"></script>
|
||||
<script src="src/xml.js?version=2021-07-05"></script>
|
||||
<script src="src/store.js?version=2021-08-01"></script>
|
||||
<script src="src/store.js?version=2021-10-05"></script>
|
||||
<script src="src/locale.js?version=2021-10-04"></script>
|
||||
<script src="src/cloud.js?version=2021-02-04"></script>
|
||||
<script src="src/api.js?version=2021-07-05"></script>
|
||||
|
|
24
src/store.js
24
src/store.js
|
@ -63,7 +63,7 @@ Project*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.store = '2021-August-01';
|
||||
modules.store = '2021-October-05';
|
||||
|
||||
// XML_Serializer ///////////////////////////////////////////////////////
|
||||
/*
|
||||
|
@ -946,6 +946,7 @@ SnapSerializer.prototype.loadVariables = function (varFrame, element, object) {
|
|||
value = child.children[0];
|
||||
v = new Variable();
|
||||
v.isTransient = (child.attributes.transient === 'true');
|
||||
v.isHidden = (child.attributes.hidden === 'true');
|
||||
v.value = (v.isTransient || !value ) ? 0
|
||||
: this.loadValue(value, object);
|
||||
varFrame.vars[child.attributes.name] = v;
|
||||
|
@ -1930,17 +1931,24 @@ Sound.prototype.toXML = function (serializer) {
|
|||
VariableFrame.prototype.toXML = function (serializer) {
|
||||
return Object.keys(this.vars).reduce((vars, v) => {
|
||||
var val = this.vars[v].value,
|
||||
transient = this.vars[v].isTransient,
|
||||
hidden = this.vars[v].isHidden,
|
||||
dta;
|
||||
if (this.vars[v].isTransient) {
|
||||
|
||||
if (transient || val === undefined || val === null) {
|
||||
dta = serializer.format(
|
||||
'<variable name="@" transient="true"/>',
|
||||
v)
|
||||
;
|
||||
} else if (val === undefined || val === null) {
|
||||
dta = serializer.format('<variable name="@"/>', v);
|
||||
'<variable name="@"' +
|
||||
(transient ? ' transient="true"' : '') +
|
||||
(hidden ? ' hidden="true"' : '') +
|
||||
'/>',
|
||||
v
|
||||
);
|
||||
} else {
|
||||
dta = serializer.format(
|
||||
'<variable name="@">%</variable>',
|
||||
'<variable name="@"' +
|
||||
(transient ? ' transient="true"' : '') +
|
||||
(hidden ? ' hidden="true"' : '') +
|
||||
'>%</variable>',
|
||||
v,
|
||||
typeof val === 'object' ?
|
||||
(isSnapObject(val) ? ''
|
||||
|
|
|
@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.threads = '2021-October-04';
|
||||
modules.threads = '2021-October-05';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
@ -7024,18 +7024,20 @@ Context.prototype.isInCustomBlock = function () {
|
|||
|
||||
// Variable /////////////////////////////////////////////////////////////////
|
||||
|
||||
function Variable(value, isTransient) {
|
||||
function Variable(value, isTransient, isHidden) {
|
||||
this.value = value;
|
||||
this.isTransient = isTransient || false; // prevent value serialization
|
||||
this.isHidden = isHidden || false; // not shown in the blocks palette
|
||||
}
|
||||
|
||||
Variable.prototype.toString = function () {
|
||||
return 'a ' + (this.isTransient ? 'transient ' : '') + 'Variable [' +
|
||||
this.value + ']';
|
||||
return 'a ' + (this.isTransient ? 'transient ' : '') +
|
||||
(this.isHidden ? 'hidden ' : '') +
|
||||
'Variable [' + this.value + ']';
|
||||
};
|
||||
|
||||
Variable.prototype.copy = function () {
|
||||
return new Variable(this.value, this.isTransient);
|
||||
return new Variable(this.value, this.isTransient, this.isHidden);
|
||||
};
|
||||
|
||||
// VariableFrame ///////////////////////////////////////////////////////
|
||||
|
|
Ładowanie…
Reference in New Issue