@@ -96,7 +96,7 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
: super.defaultOptions ?? {};
|
||||
return Object.assign({}, base, {
|
||||
id: 'scrying-pool-strip',
|
||||
template: 'modules/video-view-manager/templates/roster-strip.hbs',
|
||||
template: 'modules/scrying-pool/templates/roster-strip.hbs',
|
||||
popOut: true,
|
||||
resizable: false,
|
||||
title: 'Scrying Pool',
|
||||
@@ -140,7 +140,7 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
getData() {
|
||||
const savedState =
|
||||
typeof game !== 'undefined'
|
||||
? game.user?.getFlag?.('video-view-manager', 'stripState')
|
||||
? game.user?.getFlag?.('scrying-pool', 'stripState')
|
||||
: null;
|
||||
if (savedState?.expanded !== undefined) {
|
||||
this._isExpanded = savedState.expanded;
|
||||
@@ -148,17 +148,24 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
|
||||
const showFirstOpenTip =
|
||||
typeof game !== 'undefined' &&
|
||||
!game.user?.getFlag?.('video-view-manager', 'firstStripOpen');
|
||||
!game.user?.getFlag?.('scrying-pool', 'firstStripOpen');
|
||||
|
||||
const userIds = this._adapter.users.all
|
||||
? this._adapter.users.all().map(u => u.id)
|
||||
: [];
|
||||
|
||||
// Respect the showGMSelfFeed setting: if false, exclude the current GM user
|
||||
const showGMSelfFeed = this._adapter.settings?.get?.('showGMSelfFeed') ?? true;
|
||||
const currentUserId = this._adapter.users.current?.()?.id;
|
||||
const filteredUserIds = showGMSelfFeed
|
||||
? userIds
|
||||
: userIds.filter(id => id !== currentUserId);
|
||||
|
||||
// Check if we have stream access for video replacement (full AV replacement mode)
|
||||
const hasStreamAccess = this._adapter.webrtc?.getMediaStreamForUser !== undefined;
|
||||
|
||||
const participants = buildParticipantList(
|
||||
userIds,
|
||||
filteredUserIds,
|
||||
this._stateStore,
|
||||
this._controller,
|
||||
this._adapter,
|
||||
@@ -208,18 +215,56 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
});
|
||||
}
|
||||
|
||||
// Custom close button (replaces Foundry window header close)
|
||||
const closeBtn = el.querySelector('[data-action="close-strip"]');
|
||||
if (closeBtn) {
|
||||
closeBtn.addEventListener('click', () => this.close());
|
||||
}
|
||||
|
||||
// Drag grip — custom drag implementation (Foundry v14 ApplicationV1 does not expose its drag handler)
|
||||
const grip = el.querySelector('[data-action="drag-grip"]');
|
||||
if (grip) {
|
||||
grip.addEventListener('mousedown', e => {
|
||||
if (e.button !== 0) return;
|
||||
e.preventDefault();
|
||||
const startX = e.clientX;
|
||||
const startY = e.clientY;
|
||||
const { left: startLeft, top: startTop } = this.position;
|
||||
|
||||
const onMove = mv => {
|
||||
this.setPosition({
|
||||
left: startLeft + (mv.clientX - startX),
|
||||
top: startTop + (mv.clientY - startY),
|
||||
});
|
||||
};
|
||||
const onUp = () => {
|
||||
document.removeEventListener('mousemove', onMove);
|
||||
document.removeEventListener('mouseup', onUp);
|
||||
};
|
||||
document.addEventListener('mousemove', onMove);
|
||||
document.addEventListener('mouseup', onUp);
|
||||
});
|
||||
}
|
||||
|
||||
// First open tip: set flag so it doesn't show again
|
||||
const isFirstOpen =
|
||||
typeof game !== 'undefined' &&
|
||||
!game.user?.getFlag?.('video-view-manager', 'firstStripOpen');
|
||||
!game.user?.getFlag?.('scrying-pool', 'firstStripOpen');
|
||||
if (isFirstOpen) {
|
||||
game.user?.setFlag?.('video-view-manager', 'firstStripOpen', true);
|
||||
game.user?.setFlag?.('scrying-pool', 'firstStripOpen', true);
|
||||
}
|
||||
|
||||
// Attach video streams if we have stream access (full AV replacement mode)
|
||||
if (this._adapter.webrtc?.getMediaStreamForUser !== undefined) {
|
||||
this._attachVideoStreams(el);
|
||||
}
|
||||
|
||||
// Sync the outer Application window width with the expanded/collapsed state.
|
||||
// The LESS max-width only applies to the inner template div (.scrying-pool.scrying-pool-strip);
|
||||
// the outer window must be explicitly resized so it doesn't clip the expanded content.
|
||||
if (typeof this.setPosition === 'function') {
|
||||
this.setPosition({ width: this._isExpanded ? 240 : 44, height: 'auto' });
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@@ -233,7 +278,7 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
this._cleanupVideoStreams();
|
||||
|
||||
if (typeof game !== 'undefined') {
|
||||
game.user?.setFlag?.('video-view-manager', 'stripState', {
|
||||
game.user?.setFlag?.('scrying-pool', 'stripState', {
|
||||
left: this.position?.left,
|
||||
top: this.position?.top,
|
||||
open: false,
|
||||
@@ -267,7 +312,7 @@ export class ScryingPoolStrip extends _AppBase {
|
||||
_toggleExpanded() {
|
||||
this._isExpanded = !this._isExpanded;
|
||||
if (typeof game !== 'undefined') {
|
||||
game.user?.setFlag?.('video-view-manager', 'stripState', {
|
||||
game.user?.setFlag?.('scrying-pool', 'stripState', {
|
||||
left: this.position?.left,
|
||||
top: this.position?.top,
|
||||
open: true,
|
||||
|
||||
Reference in New Issue
Block a user