mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Add avatar double click event
This commit is contained in:
parent
3a3c152f79
commit
dbe2388272
@ -14,6 +14,7 @@ export class RoomEngineObjectEvent extends RoomEngineEvent
|
||||
public static REQUEST_MANIPULATION: string = 'REOE_REQUEST_MANIPULATION';
|
||||
public static MOUSE_ENTER: string = 'REOE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'REOE_MOUSE_LEAVE';
|
||||
public static DOUBLE_CLICK: string = 'REOE_DOUBLE_CLICK';
|
||||
|
||||
private _objectId: number;
|
||||
private _category: number;
|
||||
|
@ -296,6 +296,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
case RoomObjectMouseEvent.CLICK:
|
||||
this.handleRoomObjectMouseClickEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.DOUBLE_CLICK:
|
||||
this.handleRoomObjectMouseDoubleClickEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.MOUSE_MOVE:
|
||||
this.handleRoomObjectMouseMoveEvent(event, roomId);
|
||||
return;
|
||||
@ -491,6 +494,18 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseDoubleClickEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
const id = event.objectId;
|
||||
const type = event.objectType;
|
||||
const category = this._roomEngine.getRoomObjectCategoryForType(type);
|
||||
|
||||
if(this._roomEngine.events)
|
||||
{
|
||||
this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DOUBLE_CLICK, roomId, id, category));
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseMoveEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
@ -57,7 +57,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
|
||||
public getEventTypes(): string[]
|
||||
{
|
||||
const types = [RoomObjectMouseEvent.CLICK, RoomObjectMoveEvent.POSITION_CHANGED, RoomObjectMouseEvent.MOUSE_ENTER, RoomObjectMouseEvent.MOUSE_LEAVE, RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW];
|
||||
const types = [RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.DOUBLE_CLICK, RoomObjectMoveEvent.POSITION_CHANGED, RoomObjectMouseEvent.MOUSE_ENTER, RoomObjectMouseEvent.MOUSE_LEAVE, RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW];
|
||||
|
||||
return this.mergeTypes(super.getEventTypes(), types);
|
||||
}
|
||||
@ -461,6 +461,9 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
eventType = RoomObjectMouseEvent.CLICK;
|
||||
break;
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
eventType = RoomObjectMouseEvent.DOUBLE_CLICK;
|
||||
break;
|
||||
case MouseEventType.ROLL_OVER:
|
||||
eventType = RoomObjectMouseEvent.MOUSE_ENTER;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user