custom-hot-zone.component.html 10.7 KB
Newer Older
范雪寒's avatar
范雪寒 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<div class="p-image-children-editor">

  <h5 style="margin-left: 2.5%;"> preview: </h5>

  <div class="preview-box" #wrap>
    <canvas id="canvas" #canvas></canvas>
  </div>

  <div nz-row nzType="flex" nzAlign="middle">
    <div nz-col nzSpan="5" nzOffset="1">

      <h5> add background: </h5>

      <div class="bg-box">
        <app-upload-image-with-preview
          [picUrl]="bgItem?.url"
          (imageUploaded)="onBackgroundUploadSuccess($event)">
        </app-upload-image-with-preview>
      </div>
    </div>

    <div nz-col nzSpan="5" nzOffset="1" class="img-box"
         *ngFor="let it of hotZoneArr; let i = index">

      <div
        style="margin: auto; padding: 5px;  margin-top: 30px; width:90%; border: 2px dashed #ddd; border-radius: 10px">
        <span style="margin-left: 40%;"> item-{{i + 1}}
        </span>
        <button style="float: right;" nz-button nzType="danger" nzSize="small" (click)="deleteBtnClick(i)">
          X
        </button>

        <nz-divider style="margin-top: 10px;"></nz-divider>

liujiangnan's avatar
liujiangnan committed
35
        <div style="margin-top: -20px; margin-bottom: 5px; width: 100%;">
范雪寒's avatar
范雪寒 committed
36

liujiangnan's avatar
liujiangnan committed
37 38 39 40 41 42
          <div *ngIf="customTypeGroupArr">
            <nz-radio-group [ngModel]="it.gIdx" (ngModelChange)="customRadioChange($event, it)"  style="display: flex; align-items: center; justify-content: center; flex-wrap: wrap;">
              <div *ngFor="let group of customTypeGroupArr; let gIdx = index" style="display: flex; ">
                <label nz-radio nzValue="{{gIdx}}">{{group.name}}</label>
              </div>
            </nz-radio-group>
范雪寒's avatar
范雪寒 committed
43

liujiangnan's avatar
liujiangnan committed
44 45 46 47 48 49 50 51 52 53 54
          </div>

          <!-- <div *ngIf="!customTypeGroupArr">
            <nz-radio-group [ngModel]="it.itemType" (ngModelChange)="radioChange($event, it)"  style="display: flex; align-items: center; justify-content: center">

              <label *ngIf="isHasRect" nz-radio nzValue="rect">矩形</label>
              <label *ngIf="isHasPic" nz-radio nzValue="pic">图片</label>
              <label *ngIf="isHasText" nz-radio nzValue="text">文本</label>

            </nz-radio-group>
          </div> -->
范雪寒's avatar
范雪寒 committed
55 56 57

        </div>

liujiangnan's avatar
liujiangnan committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
        <div *ngIf="customTypeGroupArr && customTypeGroupArr[it.gIdx]">

          <div *ngIf="customTypeGroupArr[it.gIdx].pic">
            <app-upload-image-with-preview
              [picUrl]="it?.pic_url"
              (imageUploaded)="onItemImgUploadSuccess($event, it)">
            </app-upload-image-with-preview>
          </div>

          <div *ngIf="customTypeGroupArr[it.gIdx].text" style="margin-top: 5px">
            <input type="text" nz-input [(ngModel)]="it.text" (blur)="saveText(it)">
          </div>

          <div *ngIf="customTypeGroupArr[it.gIdx].anima" align="center" style="margin-top: 5px">
            <button nz-button (click)="setAnimaBtnClick(i)" >
              <i nz-icon nzType="tool" nzTheme="outline"></i>
              配置龙骨动画
            </button>
          </div>

          <div *ngIf="customTypeGroupArr[it.gIdx].animaSmall" align="center" style="margin-top: 5px">
            <button nz-button (click)="setAnimaSmallBtnClick(i)" >
              <i nz-icon nzType="tool" nzTheme="outline"></i>
              配置龙骨动画(小)
            </button>
          </div>


          <div *ngIf="customTypeGroupArr[it.gIdx].audio" style="display: flex;align-items: center; margin-top: 5px">
            <app-audio-recorder
              style="margin: auto"
              [audioUrl]="it.audio_url"
              (audioUploaded)="onItemAudioUploadSuccess($event, it)"
            ></app-audio-recorder>
          </div>

<!--          <div *ngIf="customTypeGroupArr[it.gIdx]?.action" style="display: flex;align-items: center; margin-top: 5px">-->
<!--            <app-custom-action-->
<!--              style="margin: auto"-->
<!--              [item]="it ? it['actionData_' + it.gIdx] : {}"-->
<!--              [type]="customTypeGroupArr[it.gIdx].action.type"-->
<!--              [option]="customTypeGroupArr[it.gIdx].action.option"-->
<!--              (save)="onSaveCustomAction($event, it)">-->
<!--            ></app-custom-action>-->
<!--          </div>-->

          <div *ngIf="customTypeGroupArr[it.gIdx]?.isShowPos" style="display: flex; align-items: center; justify-content: center; margin-top: 5px;">
            x: <input type="text" nz-input [(ngModel)]="it.posX" style="width: 50px; margin-right: 15px;" (blur)="saveItemPos(it)">
            y: <input type="text" nz-input [(ngModel)]="it.posY" style="width: 50px" (blur)="saveItemPos(it)">
          </div>

          <div *ngIf="customTypeGroupArr[it.gIdx]?.select" align="center" >
            <nz-select [(ngModel)]="it.selectType" nzAllowClear nzPlaceHolder="Choose" style="width: 70%; margin-top: 5px;">
              <nz-option *ngFor="let s of customTypeGroupArr[it.gIdx]?.select" [nzValue]="s.value" [nzLabel]="s.label">
              </nz-option>
            </nz-select>
          </div>

          <div *ngIf="customTypeGroupArr[it.gIdx]?.label" align="center" style="margin-top: 5px; display: flex; align-items: center; justify-content: center;">
            <span style="width: 30%;">{{customTypeGroupArr[it.gIdx].label + ':'}}</span>
            <input type="text" nz-input [(ngModel)]="it.labelText" (blur)="saveText(it)">
          </div>

<!--          <div *ngIf="customTypeGroupArr[it.gIdx]?.mathLabel" align="center" style="margin-top: 5px; display: flex; align-items: center; justify-content: center;">-->
<!--            <span style="width: 30%;">{{customTypeGroupArr[it.gIdx].mathLabel + ':'}}</span>-->
<!--            <app-formula-input [(ngfModel)]="it.mathLabel" ></app-formula-input>-->

<!--          </div>-->


          <div *ngIf="customTypeGroupArr[it.gIdx]?.isCopy" align="center" style="margin-top: 5px; display: flex; align-items: center; justify-content: center;">
            <button nz-button (click)="copyItem(it)" >
              <i nz-icon nzType="copy" nzTheme="outline"></i>
              复制粘贴
            </button>
          </div>

范雪寒's avatar
范雪寒 committed
135 136
        </div>

liujiangnan's avatar
liujiangnan committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171


        <!-- <div *ngIf="!customTypeGroupArr">

          <div *ngIf="it.itemType == 'pic'">
            <app-upload-image-with-preview
              [picUrl]="it?.pic_url"
              (imageUploaded)="onItemImgUploadSuccess($event, it)">
            </app-upload-image-with-preview>
          </div>

          <div *ngIf="it.itemType == 'text'">
            <input type="text" nz-input [(ngModel)]="it.text" (blur)="saveText(it)">
          </div>

          <div *ngIf="isHasAudio"
               style="width: 100%; margin-top: 5px; display: flex; align-items: center; justify-items: center;">
            <app-audio-recorder
              style="margin: auto"
              [audioUrl]="it.audio_url"
              (audioUploaded)="onItemAudioUploadSuccess($event, it)"
            ></app-audio-recorder>
          </div>

          <div *ngIf="it.itemType == 'rect' && isHasAnima" align="center" style="margin-bottom: 5px">
            <button nz-button (click)="setAnimaBtnClick(i)" >
              <i nz-icon nzType="tool" nzTheme="outline"></i>
              配置龙骨动画
            </button>
          </div>

        </div> -->



范雪寒's avatar
范雪寒 committed
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
      </div>

    </div>


    <div nz-col nzSpan="5" nzOffset="1">

      <div class="bg-box">
        <button nz-button nzType="dashed" (click)="addBtnClick()"
                class="add-btn">
          <i nz-icon nzType="plus-circle" nzTheme="outline"></i>
          <!--Add Image-->
          Add hot zone
        </button>
      </div>

    </div>
  </div>


  <nz-divider></nz-divider>

  <div class="save-box">

liujiangnan's avatar
liujiangnan committed
196
    <button style="margin-left: 200px" class="save-btn" nz-button nzType="primary" [nzSize]="'large'" nzShape="round"
范雪寒's avatar
范雪寒 committed
197 198 199 200 201
            (click)="saveClick()" >
      <i nz-icon nzType="save"></i>
      Save
    </button>

liujiangnan's avatar
liujiangnan committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
    <div *ngIf="isCopyData" style="height: 40px; display: flex; justify-items: center;" >

      <label style="margin-left: 40px" nz-checkbox [(ngModel)]="bgItem.isShowDebugLine">显示辅助框</label>

      <button style="margin-left: 20px; margin-top: -5px" nz-button (click)="copyHotZoneData()"> 复制基础数据 </button>
      <div style="margin-left: 10px; margin-top: -5px" >

        <span>粘贴数据: </span>
        <input style="width: 100px;" type="text" nz-input [(ngModel)]="pasteData" >
        <button style="margin-left: 5px;" nz-button [disabled]="pasteData==''" nzType="primary" (click)="importData()">导入</button>

      </div>


    </div>


范雪寒's avatar
范雪寒 committed
219 220 221 222 223 224 225 226 227
  </div>


</div>


<label style="opacity: 0; position: absolute; top: 0px; font-family: 'BRLNSR_1'">1</label>


liujiangnan's avatar
liujiangnan committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
<!--龙骨面板-->
<nz-modal [(nzVisible)]="animaPanelVisible" nzTitle="配置资源文件"   (nzAfterClose)="closeAfterPanel()" (nzOnCancel)="animaPanelCancel()" (nzOnOk)="animaPanelOk()" nzOkText="保存">

  <div class="anima-upload-btn">
    <span style="margin-right: 10px">上传 ske_json 文件: </span>
    <nz-upload [nzShowUploadList]="false"
               nzAccept="application/json"
               [nzAction]="uploadUrl"
               [nzData]="uploadData"
               (nzChange)="skeJsonHandleChange($event)">
      <button nz-button><i nz-icon nzType="upload"></i><span>Upload</span></button>
    </nz-upload>
    <i *ngIf="isSkeJsonLoading" style="margin-left: 10px;" nz-icon [nzType]="'loading'"></i>
    <span *ngIf="skeJsonData['name']" style="margin-left: 10px"><u> {{skeJsonData['name']}} </u></span>
  </div>

  <div class="anima-upload-btn">
    <span style="margin-right: 10px">上传 tex_json 文件: </span>
    <nz-upload [nzShowUploadList]="false"
               nzAccept="application/json"
               [nzAction]="uploadUrl"
               [nzData]="uploadData"
               (nzChange)="texJsonHandleChange($event)">
      <button nz-button><i nz-icon nzType="upload"></i><span>Upload</span></button>
    </nz-upload>
    <i *ngIf="isTexJsonLoading" style="margin-left: 10px;" nz-icon [nzType]="'loading'"></i>
    <span *ngIf="texJsonData['name']" style="margin-left: 10px"><u> {{texJsonData['name']}} </u></span>
  </div>

  <div class="anima-upload-btn">
    <span style="margin-right: 10px">上传 tex_png 文件: </span>
    <nz-upload [nzShowUploadList]="false"
               nzAccept = "image/*"
               [nzAction]="uploadUrl"
               [nzData]="uploadData"
               (nzChange)="texPngHandleChange($event)">
      <button nz-button><i nz-icon nzType="upload"></i><span>Upload</span></button>
    </nz-upload>
    <i *ngIf="isTexPngLoading" style="margin-left: 10px;" nz-icon [nzType]="'loading'"></i>
    <span *ngIf="texPngData['name']" style="margin-left: 10px"><u> {{texPngData['name']}} </u></span>
  </div>

  <div class="anima-upload-btn" *ngIf="customTypeGroupArr && customTypeGroupArr[curDragonBoneGIdx] && customTypeGroupArr[curDragonBoneGIdx].animaNames">
    提示:需包含以下动画: {{customTypeGroupArr[curDragonBoneGIdx].animaNames.toString()}}
  </div>

</nz-modal>