From 0b42fb88ac8f315361557a575153be7a4ca7812c Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Mon, 23 May 2022 13:11:39 +1000 Subject: Display separate images tile-info for compound-image node --- src/components/TileInfoModal.vue | 109 +++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 39 deletions(-) diff --git a/src/components/TileInfoModal.vue b/src/components/TileInfoModal.vue index 5bf57c0..904b2e7 100644 --- a/src/components/TileInfoModal.vue +++ b/src/components/TileInfoModal.vue @@ -21,8 +21,12 @@ export default defineComponent({ data(){ return { tolNode: null as null | TolNode, - descData: null as null | DescInfo | [DescInfo, DescInfo], - imgData: null as null | ImgInfo | [ImgInfo, ImgInfo], + descInfo: null as null | DescInfo, + descInfo1: null as null | DescInfo, + descInfo2: null as null | DescInfo, + imgInfo: null as null | ImgInfo, + imgInfo1: null as null | ImgInfo, + imgInfo2: null as null | ImgInfo, }; }, props: { @@ -45,6 +49,15 @@ export default defineComponent({ subName2(): string { return this.displayName.substring(this.displayName.indexOf(' + ') + 3, this.displayName.length - 1); }, + imgStyles(): Record { + return this.getImgStyles(this.tolNode == null ? null : this.tolNode.imgName as string); + }, + firstImgStyles(): Record { + return this.getImgStyles(this.tolNode!.imgName![0]); + }, + secondImgStyles(): Record { + return this.getImgStyles(this.tolNode!.imgName![1]); + }, dummyNode(): LayoutNode { let newNode = new LayoutNode(this.nodeName, []); newNode.dims = [this.uiOpts.infoModalImgSz, this.uiOpts.infoModalImgSz]; @@ -57,6 +70,20 @@ export default defineComponent({ this.$emit('info-modal-close'); } }, + getImgStyles(imgName: string | null){ + return { + boxShadow: this.uiOpts.shadowNormal, + borderRadius: this.uiOpts.borderRadius + 'px', + backgroundImage: imgName != null ? + 'linear-gradient(to bottom, rgba(0,0,0,0.4), #0000 40%, #0000 60%, rgba(0,0,0,0.4) 100%),' + + 'url(\'/img/' + imgName.replaceAll('\'', '\\\'') + '\')' : + 'none', + backgroundColor: '#1c1917', + backgroundSize: 'cover', + width: this.uiOpts.infoModalImgSz + 'px', + height: this.uiOpts.infoModalImgSz + 'px', + }; + }, }, created(){ let url = new URL(window.location.href); @@ -68,8 +95,17 @@ export default defineComponent({ .then(obj => { if (obj != null){ this.tolNode = obj.nodeObj; - this.descData = obj.descData; - this.imgData = obj.imgData; + if (!Array.isArray(obj.descData)){ + this.descInfo = obj.descData; + } else { + [this.descInfo1, this.descInfo2] = obj.descData; + } + if (!Array.isArray(obj.imgData)){ + this.imgInfo = obj.imgData; + } else { + [this.imgInfo1, this.imgInfo2] = obj.imgData; + } + } }); }, @@ -92,60 +128,55 @@ export default defineComponent({
-
- -
- (No image found) -
-
-
    -
  • License: {{imgData.license}}
  • -
  • Source URL
  • -
  • Copyright Owner: {{imgData.copyrightOwner}}
  • +
    +
    +
    +
    +
      +
    • License: {{imgInfo.license}}
    • +
    • Source URL
    • +
    • Copyright Owner: {{imgInfo.copyrightOwner}}
    -
    -

    Top-left Image

    -
      -
    • License: {{imgData[0].license}}
    • -
    • Source URL
    • -
    • Copyright Owner: {{imgData[0].copyrightOwner}}
    • -
    -
    -
    -

    Bottom-right Image

    -
      -
    • License: {{imgData[1].license}}
    • -
    • Source URL
    • -
    • Copyright Owner: {{imgData[1].copyrightOwner}}
    • -
    -
    +
    +
      +
    • License: {{imgInfo1.license}}
    • +
    • Source URL
    • +
    • Copyright Owner: {{imgInfo1.copyrightOwner}}
    • +
    +
    +
      +
    • License: {{imgInfo2.license}}
    • +
    • Source URL
    • +
    • Copyright Owner: {{imgInfo2.copyrightOwner}}
    • +
    -
    +
    (No description found)
    -
    +
    - Redirected: {{descData.fromRedirect}}
    - Short-description from {{descData.fromDbp ? 'DBpedia' : 'Wikipedia'}}
    - + Redirected: {{descInfo.fromRedirect}}
    + Short-description from {{descInfo.fromDbp ? 'DBpedia' : 'Wikipedia'}}
    +
    Wikipedia Link

    -
    {{descData.text}}
    +
    {{descInfo.text}}

    {{subName1}}

    -
    {{descData[0].text}}
    +
    {{descInfo1.text}}
    +
    (No description found)

    {{subName2}}

    -
    {{descData[1].text}}
    +
    {{descInfo2.text}}
    +
    (No description found)
    -- cgit v1.2.3