提交 5c71c4f8 编写于 作者: P pengyanggit

Signed-off-by:pengyanggit<yangpeng177@huawei.com>

Signed-off-by: Npengyanggit <yangpeng177@huawei.com>
Change-Id: I0ed5c3c4accd1cf133f8f93018dab5721ef1e707
上级 41ad8f8c
...@@ -86,7 +86,7 @@ struct Index { ...@@ -86,7 +86,7 @@ struct Index {
@State abstractContent: string = "abstract"; @State abstractContent: string = "abstract";
@State textContent: string = ""; @State textContent: string = "";
hasUdmfData(event: DragEvent, callback: (data: DragEvent)=>void) getDataFromUdmfRetry(event: DragEvent, callback: (data: DragEvent)=>void)
{ {
let records: Array<udmf.UnifiedRecord> = event.getData().getRecords(); let records: Array<udmf.UnifiedRecord> = event.getData().getRecords();
if (records.length !== 0) { if (records.length !== 0) {
...@@ -96,13 +96,13 @@ struct Index { ...@@ -96,13 +96,13 @@ struct Index {
return false; return false;
} }
getDataFromUdmfRetry(event: DragEvent, callback: (data: DragEvent)=>void) getDataFromUdmf(event: DragEvent, callback: (data: DragEvent)=>void)
{ {
if(this.hasUdmfData(event, callback)) { if(this.getDataFromUdmfRetry(event, callback)) {
return; return;
} }
setTimeout(()=>{ setTimeout(()=>{
this.hasUdmfData(event, callback); this.getDataFromUdmfRetry(event, callback);
}, 1500); }, 1500);
} }
...@@ -183,7 +183,7 @@ struct Index { ...@@ -183,7 +183,7 @@ struct Index {
.border({color: Color.Black, width: 1}) .border({color: Color.Black, width: 1})
.allowDrop([udmf.UnifiedDataType.IMAGE]) .allowDrop([udmf.UnifiedDataType.IMAGE])
.onDrop((dragEvent: DragEvent)=> { .onDrop((dragEvent: DragEvent)=> {
this.getDataFromUdmfRetry(dragEvent, (event)=>{ this.getDataFromUdmf(dragEvent, (event)=>{
let records: Array<udmf.UnifiedRecord> = event.getData().getRecords(); let records: Array<udmf.UnifiedRecord> = event.getData().getRecords();
let rect: Rectangle = event.getPreviewRect(); let rect: Rectangle = event.getPreviewRect();
this.imageWidth = Number(rect.width); this.imageWidth = Number(rect.width);
...@@ -206,7 +206,7 @@ struct Index { ...@@ -206,7 +206,7 @@ struct Index {
.margin(15) .margin(15)
.allowDrop([udmf.UnifiedDataType.TEXT]) .allowDrop([udmf.UnifiedDataType.TEXT])
.onDrop((dragEvent: DragEvent)=>{ .onDrop((dragEvent: DragEvent)=>{
this.getDataFromUdmfRetry(dragEvent, event => { this.getDataFromUdmf(dragEvent, event => {
let records:Array<udmf.UnifiedRecord> = event.getData().getRecords(); let records:Array<udmf.UnifiedRecord> = event.getData().getRecords();
this.targetText = (<udmf.Text>(records[0])).details['value']; this.targetText = (<udmf.Text>(records[0])).details['value'];
}) })
...@@ -224,7 +224,7 @@ struct Index { ...@@ -224,7 +224,7 @@ struct Index {
}.width('100%').height(100).margin(20).border({color: Color.Black, width: 1}) }.width('100%').height(100).margin(20).border({color: Color.Black, width: 1})
.allowDrop([udmf.UnifiedDataType.PLAIN_TEXT]) .allowDrop([udmf.UnifiedDataType.PLAIN_TEXT])
.onDrop((dragEvent)=>{ .onDrop((dragEvent)=>{
this.getDataFromUdmfRetry(dragEvent, event=>{ this.getDataFromUdmf(dragEvent, event=>{
let records: Array<udmf.UnifiedRecord> = event.getData().getRecords(); let records: Array<udmf.UnifiedRecord> = event.getData().getRecords();
let plainText: udmf.PlainText = <udmf.PlainText>(records[0]); let plainText: udmf.PlainText = <udmf.PlainText>(records[0]);
this.abstractContent = plainText.abstract; this.abstractContent = plainText.abstract;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册