mirror of
https://github.com/overte-org/overte.git
synced 2025-06-22 14:01:03 +02:00
Add ability to click on message to display chat window.
This commit is contained in:
parent
382e47471e
commit
c933f21a77
1 changed files with 30 additions and 0 deletions
|
@ -1,3 +1,17 @@
|
||||||
|
//
|
||||||
|
// notificationCore.js
|
||||||
|
//
|
||||||
|
// Created by Fluffy Jenkins January 2020.
|
||||||
|
// Copyright 2020 Fluffy Jenkins
|
||||||
|
// Copyright 2020 Vircadia contributors.
|
||||||
|
//
|
||||||
|
// For any future coders, please keep me in the loop when making changes.
|
||||||
|
// Please tag me in any Pull Requests.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var notificationList = [];
|
var notificationList = [];
|
||||||
|
|
||||||
|
@ -6,6 +20,7 @@ var sizeData = {30: {widthMul: 1.8, heightMul: 2.05, split: 35, size: 30}};
|
||||||
var DEFAULT_SIZE = 30;
|
var DEFAULT_SIZE = 30;
|
||||||
var DEFAULT_OFFSET = 10;
|
var DEFAULT_OFFSET = 10;
|
||||||
var FLOOF_NOTIFICATION_CHANNEL = "Floof-Notif";
|
var FLOOF_NOTIFICATION_CHANNEL = "Floof-Notif";
|
||||||
|
var MAIN_CHAT_APP_CHANNEL = "Chat";
|
||||||
|
|
||||||
var offset = DEFAULT_OFFSET;
|
var offset = DEFAULT_OFFSET;
|
||||||
|
|
||||||
|
@ -161,4 +176,19 @@ function notif(text, colour) {
|
||||||
notificationList.push(noti);
|
notificationList.push(noti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Controller.mousePressEvent.connect(function (event) {
|
||||||
|
// Overlays.getOverlayAtPoint applies only to 2D overlays.
|
||||||
|
var overlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||||
|
if (overlay) {
|
||||||
|
for (var i = 0; i < notificationList.length; i++) {
|
||||||
|
if (overlay == notificationList[i].id) {
|
||||||
|
Overlays.deleteOverlay(notificationList[i].id)
|
||||||
|
Messages.sendMessage(MAIN_CHAT_APP_CHANNEL, JSON.stringify({
|
||||||
|
type: "ShowChatWindow",
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanUp);
|
Script.scriptEnding.connect(cleanUp);
|
Loading…
Reference in a new issue