Merge pull request #1579 from ShaharMS/develop

Implement `clickCount` on HTML5 and Native.
This commit is contained in:
player-03
2022-10-10 13:32:34 -04:00
committed by GitHub
7 changed files with 30 additions and 4 deletions

View File

@@ -618,7 +618,9 @@ class HTML5Window
Browser.window.addEventListener("mouseup", handleMouseEvent);
}
parent.clickCount = event.detail;
parent.onMouseDown.dispatch(x, y, event.button);
parent.clickCount = 0;
if (parent.onMouseDown.canceled && event.cancelable)
{
@@ -655,7 +657,9 @@ class HTML5Window
event.stopPropagation();
}
parent.clickCount = event.detail;
parent.onMouseUp.dispatch(x, y, event.button);
parent.clickCount = 0;
if (parent.onMouseUp.canceled && event.cancelable)
{

View File

@@ -335,10 +335,14 @@ class NativeApplication
switch (mouseEventInfo.type)
{
case MOUSE_DOWN:
window.clickCount = mouseEventInfo.clickCount;
window.onMouseDown.dispatch(mouseEventInfo.x, mouseEventInfo.y, mouseEventInfo.button);
window.clickCount = 0;
case MOUSE_UP:
window.clickCount = mouseEventInfo.clickCount;
window.onMouseUp.dispatch(mouseEventInfo.x, mouseEventInfo.y, mouseEventInfo.button);
window.clickCount = 0;
case MOUSE_MOVE:
window.onMouseMove.dispatch(mouseEventInfo.x, mouseEventInfo.y);
@@ -785,8 +789,9 @@ class NativeApplication
public var windowID:Int;
public var x:Float;
public var y:Float;
public var clickCount:Int;
public function new(type:MouseEventType = null, windowID:Int = 0, x:Float = 0, y:Float = 0, button:Int = 0, movementX:Float = 0, movementY:Float = 0)
public function new(type:MouseEventType = null, windowID:Int = 0, x:Float = 0, y:Float = 0, button:Int = 0, movementX:Float = 0, movementY:Float = 0, clickCount:Int = 0)
{
this.type = type;
this.windowID = 0;
@@ -795,11 +800,12 @@ class NativeApplication
this.button = button;
this.movementX = movementX;
this.movementY = movementY;
this.clickCount = clickCount;
}
public function clone():MouseEventInfo
{
return new MouseEventInfo(type, windowID, x, y, button, movementX, movementY);
return new MouseEventInfo(type, windowID, x, y, button, movementX, movementY, clickCount);
}
}

View File

@@ -93,6 +93,11 @@ class Window
public var x(get, set):Int;
public var y(get, set):Int;
@:allow(openfl.display.Stage)
@:allow(lime.app.Application)
@:allow(lime._internal.backend.html5.HTML5Window)
private var clickCount:Int = 0;
@:noCompletion private var __attributes:WindowAttributes;
@:noCompletion private var __backend:WindowBackend;
@:noCompletion private var __borderless:Bool;