Commit 625ec857 authored by Li MingZhe's avatar Li MingZhe

fix: 字体居中

parent 4e90e91d
No preview for this file type
<div class="position-relative"> <div class="position-relative" style="display: flex;">
<nz-upload class="p-image-uploader" [nzDisabled]="disableUpload" <nz-upload class="p-image-uploader" [nzDisabled]="disableUpload"
[nzShowUploadList]="false" [nzShowUploadList]="false"
nzAccept = "image/*" nzAccept = "image/*"
...@@ -28,10 +28,15 @@ ...@@ -28,10 +28,15 @@
</div> </div>
</div> </div>
</nz-upload> </nz-upload>
<div class="p-btn-delete" *ngIf="canDelete"
<!-- <button nz-button><i nz-icon nzType="upload"></i><span>Upload</span></button> -->
<button nz-button
nzType="danger"
*ngIf="canDelete"
nz-popconfirm nzTitle="Are you sure ?" nz-popconfirm nzTitle="Are you sure ?"
(nzOnConfirm)="onDelete()" (nzOnConfirm)="onDelete()"
> >
<i nz-icon nzType="close" nzTheme="outline"></i> <i nz-icon nzType="close" nzTheme="outline"></i>
</div> </button>
</div> </div>
...@@ -13,7 +13,7 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges { ...@@ -13,7 +13,7 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
@Input() @Input()
picUrl; picUrl;
@Input() @Input()
canDelete = false; canDelete = true;
@Output() @Output()
imageUploaded = new EventEmitter(); imageUploaded = new EventEmitter();
@Output() @Output()
...@@ -88,7 +88,9 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges { ...@@ -88,7 +88,9 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
} }
onDelete() { onDelete() {
this.delete.emit(); // this.delete.emit();
this.imageUploaded.emit({});
} }
checkSelectFile(file) { checkSelectFile(file) {
const isImg = ['image/jpeg', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp'].includes(file.type); const isImg = ['image/jpeg', 'image/png', 'image/jpeg', 'image/gif', 'image/bmp'].includes(file.type);
...@@ -120,6 +122,7 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges { ...@@ -120,6 +122,7 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
file['height'] = height; file['height'] = height;
file['width'] = width; file['width'] = width;
img.remove(); img.remove();
this.imageUploaded.emit(file.response); this.imageUploaded.emit(file.response);
// this.resService.updateImage(id, {width, height}).then( () => { // this.resService.updateImage(id, {width, height}).then( () => {
// this.imageUploaded.emit({res_id: id, id, name, hash, url}); // this.imageUploaded.emit({res_id: id, id, name, hash, url});
......
...@@ -864,6 +864,8 @@ cc.Class({ ...@@ -864,6 +864,8 @@ cc.Class({
let px, py = 0; let px, py = 0;
let isChangeLine = false; let isChangeLine = false;
let line = 0;
let lineArr = [[], []];
for (let i=0; i<answerArr.length; i++) { for (let i=0; i<answerArr.length; i++) {
const opData = answerArr[i]; const opData = answerArr[i];
const wordGroup = this.getWordGroup(opData, false, false); const wordGroup = this.getWordGroup(opData, false, false);
...@@ -883,6 +885,7 @@ cc.Class({ ...@@ -883,6 +885,7 @@ cc.Class({
answerNode.width = 0; answerNode.width = 0;
px = wordGroup.width / 2 * wordGroup.scale; px = wordGroup.width / 2 * wordGroup.scale;
py -= 100; py -= 100;
line += 1;
} }
} }
...@@ -895,6 +898,8 @@ cc.Class({ ...@@ -895,6 +898,8 @@ cc.Class({
answerNode.addChild(wordGroup) answerNode.addChild(wordGroup)
childArr.push(wordGroup); childArr.push(wordGroup);
lineArr[line].push(wordGroup);
} }
...@@ -915,6 +920,23 @@ cc.Class({ ...@@ -915,6 +920,23 @@ cc.Class({
this.answerGroupArr = childArr; this.answerGroupArr = childArr;
const line1 = lineArr[0];
const line1LastItem = line1[line1.length - 1];
const totalLine1 = line1LastItem.x + line1LastItem.width / 2;
const offX1 = (maxW - totalLine1) / 2
for (let i=0; i<line1.length; i++) {
line1[i].x += offX1;
}
const line2 = lineArr[1];
const line2LastItem = line2[line2.length - 1];
const totalLine2 = line2LastItem.x + line2LastItem.width / 2;
const offX2 = (maxW - totalLine2) / 2
for (let i=0; i<line2.length; i++) {
line2[i].x += offX2;
}
// 拖拽异常 转一下坐标 // 拖拽异常 转一下坐标
for (let i=0; i<childArr.length; i++) { for (let i=0; i<childArr.length; i++) {
const wordNode = childArr[i]; const wordNode = childArr[i];
......
No preview for this file type
{"ios":{"sceneName":"dfzx_cocos_pinjuzi","version":"96be0"},"android":{"sceneName":"dfzx_cocos_pinjuzi","version":"96be0"}} {"ios":{"sceneName":"dfzx_cocos_pinjuzi","version":"45344"},"android":{"sceneName":"dfzx_cocos_pinjuzi","version":"45344"}}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment