Event Mouse
សំរាប់
Mouse
Event កើតឡើងនៅពេលដែល mouse cursor moves or when the mouse
buttons have been pressed or released។ សំរាប់ event នេះវានឹងផ្តល់នូវពត័មានអំពី cursor’s current screen coordinates
and its button states។ វានឹងបង្កើតនៅ touch events ហើយវាក៏បង្កើតនៅ tap events នៅពេលចុចដូចគ្នា។
សំរាប់ tap’s event.numTaps property ត្រូវបញ្ចូលទៅជា១
នៅពេលដែល single clicking and 2 when double clicking។
សំរាប់ a tap event will not be raised when clicking any other mouse
button
Android:
មានតែ Android 3.1 or higher devices support a mouse តាមរយះ Bluetooth or USB។ ចំណែក Android
3.1 & 3.2 មាន mouse event តែលើ primary
button។ the event.isSecondaryButtonDown and
event.isMiddleButtonDown properties តែងតែ false នៅលើ android operating system versions។ ចុងក្រោយ
Android 4.0 and higher devices support the mouse’s secondary &
middle buttons
iOS មិនមាន mouse event ទេ
Mac សំរាប់ Corona Simulator របស់ Mac មិនមាន mouse event ដែរ
Windows
សំរាប់
Corona
Simulator សំរាប់ windows មាន mouse
events នៅពេលដែល simulating an Android device
ចំណាះ
សំរាប់
Mouse
event មិនទទួលនៅពេលដែល cursor is outside of the
application window។ ដូចជានៅពេលដែលទាញ cursor on top of
Android’s bottom navigation bar
ដូចខាងក្រោមះ
នេះជា
Properties
របស់វាះ
Properties
event.isPrimaryButtonDown
ប្រើសំរាប់បង្ហាញបើសិនជា
mouse’s
primary button was held down at the time the mouse event បានកើតឡើង។
សំរាប់ Primary button is typically the left mouse button
សូមមើលកូដះ
--
Called
when a mouse event has been received.
local
function onMouseEvent( event )
if event.isPrimaryButtonDown then
-- The mouse's primary/left button is currently
pressed down.
else
-- The mouse's primary/left button is not being
pressed.
end
end
--
Add the
mouse event listener.
Runtime:addEventListener(
"mouse", onMouseEvent )
event.isSecondaryButtonDown
ប្រើសំរាប់បង្ហាញថា
if the
mouse’s secondary button was held down at the time the mouse event បានកើតឡើង។ សំរាប់ secondary button ជា mouse
ខាងស្តាំ។ សំរាប់ android devices older than v4 do not
support the secondary mouse button។
សូមមើលកូដះ
--
Called
when a mouse event has been received.
local
function onMouseEvent( event )
if event.isSecondaryButtonDown then
-- The mouse's secondary/right button is
currently pressed down.
else
-- The mouse's secondary/right button is not
being pressed.
end
end
--
Add the
mouse event listener.
Runtime:addEventListener(
"mouse", onMouseEvent )
No comments:
Post a Comment