diff --git a/entry/src/main/ets/pages/background/Background.ets b/entry/src/main/ets/pages/background/Background.ets index 6564242e0bbe7b0cf12c53dd68542ba89f25819c..ace4e55d9c8579bbc1b9f1da4a7ecd851730855a 100644 --- a/entry/src/main/ets/pages/background/Background.ets +++ b/entry/src/main/ets/pages/background/Background.ets @@ -153,19 +153,25 @@ struct BackgroundDrag { } } }) + // [Start onDragMove] Column() { + // [StartExclude onDragMove] Image(this.targetImage) .width('100%') .height(new BreakpointType('180vp', '224vp', '391vp').getValue(this.curBp)) .fitOriginalSize(true) .constraintSize({ maxWidth: '100%' }) .borderRadius(16) + // [EndExclude onDragMove] } + // [StartExclude onDragMove] .constraintSize({ maxWidth: '100%' }) .backgroundColor($r('sys.color.comp_background_primary')) .borderRadius(16) + // [EndExclude onDragMove] .allowDrop([uniformTypeDescriptor.UniformDataType.IMAGE]) .onDrop((event?: DragEvent) => { + // [StartExclude onDragMove] try { let dragData: UnifiedData = (event as DragEvent).getData() as UnifiedData; if (dragData !== undefined) { @@ -193,7 +199,15 @@ struct BackgroundDrag { const err = error as BusinessError; hilog.error(0x0000, TAG, `startDataLoading errorCode: ${err.code}, errorMessage: ${err.message}`); } + // [EndExclude onDragMove] }) + .onDragMove((event: DragEvent) => { + hilog.info(0x0000, TAG, `The x-coordinate of the display is ${event.getDisplayX()}.`); + hilog.info(0x0000, TAG, `The y-coordinate of the display is ${event.getDisplayY()}.`); + hilog.info(0x0000, TAG, `The x-coordinate of the window is ${event.getWindowX()}.`); + hilog.info(0x0000, TAG, `The y-coordinate of the window is ${event.getWindowY()}.`); + }) + // [End onDragMove] } .padding({ left: 16,