From dd10f125ae9d261ce64fbc7731f251bf2f126b93 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Sun, 20 Jan 2019 10:44:00 +0800 Subject: [PATCH] feat(picking): change trigger pick event from pointdown to pointtap to solve "if inspector->transform->blur in canvas, not undo" bug --- .../job/init/initPickingJob/InitPickingJobUtil.re | 2 +- test/integration/job/initPickingJob_test.re | 2 +- test/integration/job/tool/InitPickingJobTool.re | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/core/utils/engine/job/init/initPickingJob/InitPickingJobUtil.re b/src/core/utils/engine/job/init/initPickingJob/InitPickingJobUtil.re index ac7db55d7..93dc2b8b2 100644 --- a/src/core/utils/engine/job/init/initPickingJob/InitPickingJobUtil.re +++ b/src/core/utils/engine/job/init/initPickingJob/InitPickingJobUtil.re @@ -254,7 +254,7 @@ let _handlePicking = (event: EventType.customEvent, engineState) => { let initJob = (_, engineState) => { let engineState = ManageEventEngineService.onCustomGlobalEvent( - ~eventName=EventEditorService.getPointDownEventName(), + ~eventName=EventEditorService.getPointTapEventName(), ~handleFunc= (. event, engineState) => MouseEventService.isLeftMouseButton(event) ? diff --git a/test/integration/job/initPickingJob_test.re b/test/integration/job/initPickingJob_test.re index 3f65a2eee..6a984cb11 100755 --- a/test/integration/job/initPickingJob_test.re +++ b/test/integration/job/initPickingJob_test.re @@ -15,7 +15,7 @@ let _ = describe("test find picked one", () => { describe("should set finded one to current scene tree node", () => { - describe("if pointdown->mouse button isn't left button", () => { + describe("if pointtap->mouse button isn't left button", () => { let _prepare = () => InitPickingJobTool.prepareOneGameObject( ~sandbox, diff --git a/test/integration/job/tool/InitPickingJobTool.re b/test/integration/job/tool/InitPickingJobTool.re index 21fdb9f79..5ed027456 100644 --- a/test/integration/job/tool/InitPickingJobTool.re +++ b/test/integration/job/tool/InitPickingJobTool.re @@ -239,6 +239,17 @@ let triggerPicking = (sandbox, pageX, pageY, eventButton) => { (), ), ); + EventTool.triggerDomEvent( + "click", + EventTool.getBody(), + MouseEventTool.buildMouseEvent( + ~pageX, + ~pageY, + ~target, + ~which=eventButton, + (), + ), + ); }; let triggerPickingAndRestore = (~eventButton=1, ~sandbox, ~pageX, ~pageY, ()) => {