Merge branch 'archive' into archive-update-v0.54.0

This commit is contained in:
Eliot Partridge
2019-09-21 22:48:14 -05:00
18 changed files with 62 additions and 16 deletions
@@ -1,5 +1,5 @@
ng-template(#actionsModal)
actions-modal((close)="closeActions()" [focusTrap]="true" (keydown)="$event.stopPropagation()")
actions-modal((close)="closeActions()" (notify)="actionsModalNotify()" (keydown)="$event.stopPropagation()")
.action-bar(
[class.has-scroller]="hasScroller" [class.is-mobile]="mobile" [class.is-blurred]="blurred"
@@ -23,6 +23,7 @@ export class ActionBar {
shortcuts = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '='];
private modalRef?: BsModalRef;
private _editable = false;
private isWaitingForActionsModal = false;
constructor(private game: PonyTownGame, private settings: SettingsService, private modalService: BsModalService) {
}
@Input() get editable() {
@@ -74,19 +75,32 @@ export class ActionBar {
}
}
openActions() {
if (this.isWaitingForActionsModal) {
return;
}
if (this.modalRef) {
this.closeActions();
}
else {
this.isWaitingForActionsModal = true;
this.modalRef = this.modalService.show(this.actionsModal, { ignoreBackdropClick: true });
}
}
closeActions() {
if (this.isWaitingForActionsModal) {
return;
}
if (this.modalRef) {
this.isWaitingForActionsModal = true;
this.modalRef.hide();
this.modalRef = undefined;
}
}
actionsModalNotify() {
this.isWaitingForActionsModal = false;
}
private updateFreeSlots() {
const actions = this.actions;
@@ -35,6 +35,7 @@ export class ActionsModal implements OnInit, OnDestroy {
readonly devIcon = faCogs;
readonly dev = BETA;
@Output() close = new EventEmitter();
@Output() notify = new EventEmitter();
actions = createButtionActionActions();
commands = createButtonCommandActions();
emoteAction = expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Smile));
@@ -83,12 +84,17 @@ export class ActionsModal implements OnInit, OnDestroy {
if (BETA) {
this.entityActions = getEntityNames().map(name => entityButtonAction(name));
}
// not using timeout here causes some event ordering issues on mobile devices, and the modal stucks being open
// in case it still happens on some devices (unlikely), would make sense to increse the delay
setTimeout(() => this.notify.emit(), 250);
}
ngOnDestroy() {
document.body.classList.remove('actions-modal-opened');
this.game.editingActions = false;
clearInterval(this.interval);
this.subscription && this.subscription.unsubscribe();
this.notify.emit();
}
ok() {
this.close.emit();
@@ -2,7 +2,7 @@ a.btn.btn-lg.btn-pt.btn-outline-primary.btn-block.mb-2(
*ngIf="enableVisitPTButton" (mouseenter)="pony.select()" (mouseout)="pony.reset()" [href]="ptLink" target="_blank"
rel="noopener noreferrer")
.pt-logo
img.pixelart.logo(revSrc="images/logo-small.png")
img.pixelart.logo(revSrc="images/logo-pt-small.png")
| {{'Visit Pony Town main server!'}}
.visit-pt-pony
visit-pt-pony(#pony [scale]="2")