Reinstated automatic English translation on hover-over for tengwar, as an official feature now instead of an accident that stopped working.
This commit is contained in:
@@ -114,10 +114,10 @@ class AutoZoom {
|
|||||||
var targetShort = Math.min(maxShortSide, CardDisplay.TargetShort);
|
var targetShort = Math.min(maxShortSide, CardDisplay.TargetShort);
|
||||||
|
|
||||||
if(card.horizontal || card.effectivelyHorizontal()) {
|
if(card.horizontal || card.effectivelyHorizontal()) {
|
||||||
this.cardDisplay.reloadFromCard(card, targetLong, targetShort);
|
this.cardDisplay.reloadFromCard(card, targetLong, targetShort, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.cardDisplay.reloadFromCard(card, targetShort, targetLong);
|
this.cardDisplay.reloadFromCard(card, targetShort, targetLong, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get position and size of the reference image (or card hint):
|
// get position and size of the reference image (or card hint):
|
||||||
@@ -206,7 +206,7 @@ class AutoZoom {
|
|||||||
// However if shift IS held AND it's rotated, we act like it's not.
|
// However if shift IS held AND it's rotated, we act like it's not.
|
||||||
// This is basically XOR; when they are the same they cancel out,
|
// This is basically XOR; when they are the same they cancel out,
|
||||||
// but when they are different they cause a rotation.
|
// but when they are different they cause a rotation.
|
||||||
this.cardDisplay.setInvert(shiftHeld != invertShift);
|
//this.cardDisplay.setInvert(shiftHeld != invertShift);
|
||||||
}
|
}
|
||||||
|
|
||||||
setPreviewMessage(reversible) {
|
setPreviewMessage(reversible) {
|
||||||
|
|||||||
@@ -55,6 +55,49 @@ class Card {
|
|||||||
static GetAlternateImage(bpid) {
|
static GetAlternateImage(bpid) {
|
||||||
return bpid.includes("^", 2);
|
return bpid.includes("^", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GetImageFromCache(blueprintid, tengwar) {
|
||||||
|
if(tengwar)
|
||||||
|
return Card.GetTengwarImageFromCache(blueprintid);
|
||||||
|
|
||||||
|
return Card.GetBaseImageFromCache(blueprintid);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GetBaseImageFromCache(blueprintid) {
|
||||||
|
let cached = Card.CardCache[blueprintid];
|
||||||
|
if(cached == null) {
|
||||||
|
cached = {
|
||||||
|
imageUrl:Card.getImageUrl(blueprintid),
|
||||||
|
backSideImageUrl:Card.getBackSideUrl(blueprintid),
|
||||||
|
incomplete:Card.isIncomplete(blueprintid),
|
||||||
|
errata:Card.isErrata(blueprintid)
|
||||||
|
};
|
||||||
|
|
||||||
|
Card.CardCache[blueprintid] = cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GetTengwarImageFromCache(blueprintid) {
|
||||||
|
let tengwarid = blueprintid + "T";
|
||||||
|
|
||||||
|
let cached = Card.CardCache[tengwarid];
|
||||||
|
if(cached == null) {
|
||||||
|
cached = {
|
||||||
|
imageUrl:Card.getImageUrl(tengwarid, true),
|
||||||
|
backSideImageUrl:Card.getBackSideUrl(tengwarid),
|
||||||
|
incomplete:Card.isIncomplete(tengwarid),
|
||||||
|
errata:Card.isErrata(tengwarid)
|
||||||
|
};
|
||||||
|
|
||||||
|
Card.CardCache[tengwarid] = cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
//blueprintId, zone, cardId, owner, siteNumber
|
//blueprintId, zone, cardId, owner, siteNumber
|
||||||
constructor (blueprintId, testingText, backSideTestingText, zone, cardId, owner, siteNumber, upsideDown, onSide) {
|
constructor (blueprintId, testingText, backSideTestingText, zone, cardId, owner, siteNumber, upsideDown, onSide) {
|
||||||
@@ -106,32 +149,11 @@ class Card {
|
|||||||
|
|
||||||
this.horizontal = Card.isHorizontal(this.bareBlueprint, this.zone);
|
this.horizontal = Card.isHorizontal(this.bareBlueprint, this.zone);
|
||||||
|
|
||||||
if (this.bareBlueprint != "-1_1" && this.bareBlueprint != "-1_2" && Card.CardCache[this.bareBlueprint] != null) {
|
var cardFromCache = Card.GetImageFromCache(this.bareBlueprint, this.tengwar);
|
||||||
var cardFromCache = Card.CardCache[this.bareBlueprint];
|
this.imageUrl = cardFromCache.imageUrl;
|
||||||
this.imageUrl = cardFromCache.imageUrl;
|
this.backSideImageUrl = cardFromCache.backSideImageUrl;
|
||||||
this.backSideImageUrl = cardFromCache.backSideImageUrl;
|
this.incomplete = cardFromCache.incomplete;
|
||||||
this.incomplete = cardFromCache.incomplete;
|
this.errata = cardFromCache.errata;
|
||||||
this.errata = cardFromCache.errata;
|
|
||||||
} else {
|
|
||||||
this.imageUrl = Card.getImageUrl(this.bareBlueprint, this.tengwar);
|
|
||||||
this.backSideImageUrl = Card.getBackSideUrl(this.bareBlueprint);
|
|
||||||
this.incomplete = Card.isIncomplete(this.bareBlueprint);
|
|
||||||
|
|
||||||
var separator = this.bareBlueprint.indexOf("_");
|
|
||||||
var setNo = parseInt(this.bareBlueprint.substr(0, separator));
|
|
||||||
var cardNo = parseInt(this.bareBlueprint.substr(separator + 1));
|
|
||||||
|
|
||||||
this.errata = Card.getErrata(setNo, cardNo) != null;
|
|
||||||
|
|
||||||
if (this.bareBlueprint != "-1_1" && this.bareBlueprint != "-1_2") {
|
|
||||||
Card.CardCache[this.bareBlueprint] = {
|
|
||||||
imageUrl:this.imageUrl,
|
|
||||||
backSideImageUrl:this.backSideImageUrl,
|
|
||||||
incomplete:this.incomplete,
|
|
||||||
errata:this.errata
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getFixedImage (blueprintId) {
|
static getFixedImage (blueprintId) {
|
||||||
@@ -328,6 +350,14 @@ class Card {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isErrata(blueprintId) {
|
||||||
|
var separator = blueprintId.indexOf("_");
|
||||||
|
var setNo = parseInt(blueprintId.substr(0, separator));
|
||||||
|
var cardNo = parseInt(blueprintId.substr(separator + 1));
|
||||||
|
|
||||||
|
return Card.getErrata(setNo, cardNo) != null;
|
||||||
|
}
|
||||||
|
|
||||||
static getImageUrl(blueprintId, tengwar, ignoreErrata) {
|
static getImageUrl(blueprintId, tengwar, ignoreErrata) {
|
||||||
let image = Card.getFixedImage(blueprintId)
|
let image = Card.getFixedImage(blueprintId)
|
||||||
if (image != null)
|
if (image != null)
|
||||||
|
|||||||
@@ -117,13 +117,21 @@ class CardDisplay {
|
|||||||
this.backside = null;
|
this.backside = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
reloadFromCard(card, maxWidth, maxHeight, noborder) {
|
reloadFromCard(card, maxWidth, maxHeight, ignoreTengwar) {
|
||||||
this.baseDiv.data("card", card);
|
this.baseDiv.data("card", card);
|
||||||
this.currentBP = card.blueprintId;
|
if(ignoreTengwar && card.isTengwar()) {
|
||||||
this.frontside = card.imageUrl;
|
this.currentBP = card.bareBlueprint;
|
||||||
if(!this.frontside) {
|
this.frontside = Card.GetBaseImageFromCache(this.currentBP).imageUrl;
|
||||||
this.frontside = Card.getImageUrl(this.currentBP);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.currentBP = card.blueprintId;
|
||||||
|
this.frontside = card.imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.frontside) {
|
||||||
|
this.frontside = Card.getImageUrl(this.currentBP);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let back = card.backSideImageUrl;
|
let back = card.backSideImageUrl;
|
||||||
if(back && !back.includes("darkcardback") && !back.includes("lightcardback")) {
|
if(back && !back.includes("darkcardback") && !back.includes("lightcardback")) {
|
||||||
@@ -143,11 +151,9 @@ class CardDisplay {
|
|||||||
this.backside = null;
|
this.backside = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.reload(maxWidth, maxHeight, card.imageUrl,
|
this.reload(maxWidth, maxHeight, this.frontside,
|
||||||
card.horizontal || card.effectivelyHorizontal(), card.foil, noborder, card.testingText);
|
card.horizontal || card.effectivelyHorizontal(), card.foil, false, card.testingText);
|
||||||
}
|
}
|
||||||
|
|
||||||
reload(maxWidth, maxHeight, image, horizontal, foil, noborder, testingText) {
|
reload(maxWidth, maxHeight, image, horizontal, foil, noborder, testingText) {
|
||||||
|
|||||||
Reference in New Issue
Block a user