resolve conflicts and lint the code

This commit is contained in:
Yueyu 2021-06-11 05:58:20 +08:00
commit dab8462349
4 changed files with 28 additions and 3 deletions

View file

@ -107,6 +107,9 @@ export default class Sprite {
setCostume (dataurl, fcn) { setCostume (dataurl, fcn) {
var img = document.createElement('img'); var img = document.createElement('img');
img.ondragstart = function () {
return false;
};
img.src = dataurl; img.src = dataurl;
this.img = img; this.img = img;
// Make a copy that is not affected by zoom transformation // Make a copy that is not affected by zoom transformation

View file

@ -201,6 +201,9 @@ export default class Library {
img.style.top = (7 * scaleMultiplier) + 'px'; img.style.top = (7 * scaleMultiplier) + 'px';
img.style.position = 'relative'; img.style.position = 'relative';
img.style.height = (data.height * scale) + 'px'; img.style.height = (data.height * scale) + 'px';
img.ondragstart = function () {
return false;
};
if (data.altmd5) { if (data.altmd5) {
IO.getAsset(data.altmd5, drawMe); IO.getAsset(data.altmd5, drawMe);
} }

View file

@ -111,6 +111,7 @@ function indexSetAnalyticsPrefs () {
function indexLoadStart () { function indexLoadStart () {
indexHideSplash(); indexHideSplash();
showLogo(); showLogo();
showGear();
gn('gettings').className = 'gettings show'; gn('gettings').className = 'gettings show';
gn('startcode').className = 'startcode show'; gn('startcode').className = 'startcode show';
@ -146,6 +147,14 @@ function showLogo () {
gn('jrlogo').className = 'jrlogo show'; gn('jrlogo').className = 'jrlogo show';
} }
function hideGear () {
gn('gear').className = 'gear hide';
}
function showGear () {
gn('gear').className = 'gear show';
}
function indexAskPlace () { function indexAskPlace () {
gn('authors').className = 'credits show'; gn('authors').className = 'credits show';
gn('authorsText').className = 'creditsText hide'; gn('authorsText').className = 'creditsText hide';
@ -206,7 +215,7 @@ function indexHidePlaceQuestion () {
gn('usageNoanswer').className = 'usageNoanswer hide'; gn('usageNoanswer').className = 'usageNoanswer hide';
} }
function optionTouched (elem) { function optionSelected (elem) {
var key = elem.target.getAttribute('data-key'); var key = elem.target.getAttribute('data-key');
var value = elem.target.getAttribute('data-value'); var value = elem.target.getAttribute('data-value');
// sometimes a touch is registered by a child of the relevant parent // sometimes a touch is registered by a child of the relevant parent
@ -230,6 +239,7 @@ function optionTouched (elem) {
function indexShowQuestion (key) { function indexShowQuestion (key) {
indexHideSplash(); indexHideSplash();
hideLogo(); hideLogo();
hideGear();
var optionType = InitialOptions.optionTypeForKey(key); var optionType = InitialOptions.optionTypeForKey(key);
if (optionType === 'place_preference') { if (optionType === 'place_preference') {
indexAskPlace(); indexAskPlace();
@ -258,7 +268,7 @@ function indexShowQuestion (key) {
optionElem.setAttribute('data-key', key); optionElem.setAttribute('data-key', key);
optionElem.setAttribute('data-value', option); optionElem.setAttribute('data-value', option);
optionElem.setAttribute('id', 'option-' + key + '-' + optionNum); optionElem.setAttribute('id', 'option-' + key + '-' + optionNum);
optionElem.onclick = optionTouched; optionElem.onclick = optionSelected;
optionsListElem.appendChild(optionElem); optionsListElem.appendChild(optionElem);
switch (optionType) { switch (optionType) {
@ -276,6 +286,15 @@ function indexShowQuestion (key) {
} }
optionNum = optionNum + 1; optionNum = optionNum + 1;
}); });
// iPad mini has the minimum screen size, it can show 13 items in one column
// and we use 3 columns as default
if (optionNum > 13 * 5) {
gn('optionsList').style['column-count'] = 8;
} else if (optionNum > 13 * 3) {
gn('optionsList').style['column-count'] = 5;
} else {
gn('optionsList').style['column-count'] = 3;
}
gn('optionsList').className = 'optionsList show'; gn('optionsList').className = 'optionsList show';
} }
} }