mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Add long touch/mouse events
This commit is contained in:
parent
c56f0d86c1
commit
4b85e85626
@ -2476,6 +2476,8 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
|
||||
else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN;
|
||||
|
||||
else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG;
|
||||
|
||||
else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP;
|
||||
}
|
||||
|
||||
|
@ -338,6 +338,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
case RoomObjectMouseEvent.MOUSE_DOWN:
|
||||
this.handleRoomObjectMouseDownEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.MOUSE_DOWN_LONG:
|
||||
this.handleRoomObjectMouseDownLongEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.MOUSE_ENTER:
|
||||
this.handleRoomObjectMouseEnterEvent(event, roomId);
|
||||
return;
|
||||
@ -605,6 +608,32 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseDownLongEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
||||
let operation = RoomObjectOperationType.OBJECT_UNDEFINED;
|
||||
|
||||
const selectedData = this.getSelectedRoomObjectData(roomId);
|
||||
|
||||
if(selectedData) operation = selectedData.operation;
|
||||
|
||||
const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType);
|
||||
|
||||
switch(operation)
|
||||
{
|
||||
case RoomObjectOperationType.OBJECT_UNDEFINED:
|
||||
if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT))
|
||||
{
|
||||
if((!event.ctrlKey && !event.shiftKey) || this._Str_25211(event))
|
||||
{
|
||||
if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseEnterEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
const id = event.objectId;
|
||||
|
@ -11,6 +11,7 @@ export class RoomEngineObjectEvent extends RoomEngineEvent
|
||||
public static CONTENT_UPDATED: string = 'REOE_CONTENT_UPDATED';
|
||||
public static REQUEST_MOVE: string = 'REOE_REQUEST_MOVE';
|
||||
public static REQUEST_ROTATE: string = 'REOE_REQUEST_ROTATE';
|
||||
public static REQUEST_MANIPULATION: string = 'REOE_REQUEST_MANIPULATION';
|
||||
public static MOUSE_ENTER: string = 'REOE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'REOE_MOUSE_LEAVE';
|
||||
|
||||
|
@ -62,7 +62,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
public getEventTypes(): string[]
|
||||
{
|
||||
const types = [ RoomObjectStateChangedEvent.STATE_CHANGE, RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.MOUSE_DOWN ];
|
||||
const types = [ RoomObjectStateChangedEvent.STATE_CHANGE, RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.MOUSE_DOWN, RoomObjectMouseEvent.MOUSE_DOWN_LONG ];
|
||||
|
||||
if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET);
|
||||
|
||||
@ -316,6 +316,14 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
}
|
||||
return;
|
||||
case MouseEventType.MOUSE_DOWN_LONG:
|
||||
if(this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN_LONG, this.object, event._Str_3463, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ export class MouseEventType
|
||||
public static DOUBLE_CLICK: string = 'double_click';
|
||||
public static MOUSE_MOVE: string = 'mousemove';
|
||||
public static MOUSE_DOWN: string = 'mousedown';
|
||||
public static MOUSE_DOWN_LONG: string = 'mousedown_long';
|
||||
public static MOUSE_UP: string = 'mouseup';
|
||||
public static ROLL_OVER: string = 'mouseover';
|
||||
public static ROLL_OUT: string = 'mouseout';
|
||||
|
@ -4,4 +4,5 @@ export class TouchEventType
|
||||
public static TOUCH_MOVE: string = 'touchmove';
|
||||
public static TOUCH_CANCEL: string = 'touchcancel';
|
||||
public static TOUCH_END: string = 'touchend';
|
||||
public static TOUCH_LONG: string = 'touchlong';
|
||||
}
|
@ -7,6 +7,7 @@ export class RoomObjectMouseEvent extends RoomObjectEvent
|
||||
public static DOUBLE_CLICK: string = 'ROE_MOUSE_DOUBLE_CLICK';
|
||||
public static MOUSE_MOVE: string = 'ROE_MOUSE_MOVE';
|
||||
public static MOUSE_DOWN: string = 'ROE_MOUSE_DOWN';
|
||||
public static MOUSE_DOWN_LONG: string = 'ROE_MOUSE_DOWN_LONG';
|
||||
public static MOUSE_UP: string = 'ROE_MOUSE_UP';
|
||||
public static MOUSE_ENTER: string = 'ROE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'ROE_MOUSE_LEAVE';
|
||||
|
Loading…
Reference in New Issue
Block a user