Skip to content

Commit

Permalink
Revert "Added Link Hitbox Scaling"
Browse files Browse the repository at this point in the history
This reverts commit 388453a.
  • Loading branch information
AlexDavies8 committed Nov 14, 2024
1 parent 0632356 commit b49f0c9
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 31 deletions.
16 changes: 0 additions & 16 deletions assets/chat/css/messages/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ $link-color-map: (
cursor: pointer;
margin-left: a.$gutter-sm;
color: a.$color-label-user;
position: relative;
z-index: 2;
}

.chat-user {
Expand Down Expand Up @@ -52,15 +50,6 @@ $link-color-map: (
color: a.$color-link;
position: relative;

// Links are over emotes and text but under usernames and the embed button
z-index: 1;
// If this calculation produces fractional pixel values the link can shift by up to half a pixel.
// This could be fixed by using pixels instead of em, but we then lose scaling of the hitboxes by
// font size
padding: calc(var(--link-size) * 1em);
margin: calc(var(--link-size) * -1em);


&:visited {
color: a.$color-link-visited;
}
Expand All @@ -70,10 +59,6 @@ $link-color-map: (
color: a.$color-link-hover;
}
}
&:last-child .externallink {
padding-bottom: 0px;
margin-bottom: 0px;
}

@each $type, $color in $link-color-map {
.#{$type}-link {
Expand All @@ -93,7 +78,6 @@ $link-color-map: (
margin-left: a.$gutter-sm;
margin-right: a.$gutter-xs;
opacity: 0.5;
z-index: 2;

&:hover {
opacity: 1;
Expand Down
2 changes: 0 additions & 2 deletions assets/chat/css/messages/user/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
vertical-align: text-top;
align-items: center;
margin-left: -(a.$gutter-xs);
position: relative;
z-index: 2;
}

.flair {
Expand Down
3 changes: 0 additions & 3 deletions assets/chat/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,9 +712,6 @@ class Chat {
$(document.body).toggleClass(`pref-fontscale`, fontscale !== 'auto');
$(document.body).attr('data-fontscale', fontscale);

// Link Hitbox Scaling
$(document.body).css('--link-size', this.settings.get('linksize') - 1);

for (const window of this.windows.values()) {
window.updateMessages(this);
}
Expand Down
1 change: 0 additions & 1 deletion assets/chat/js/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ const settingsdefault = new Map(
fontscale: 'auto',
censorbadwords: false,
disableanimations: false,
linksize: 1,
}),
);

Expand Down
4 changes: 1 addition & 3 deletions assets/chat/js/menus/ChatSettingsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class ChatSettingsMenu extends ChatMenu {
this.notificationEl = this.ui.find(
'#chat-settings-notification-permissions',
);
this.ui.on('change', 'input[type="checkbox"],select,input[type="number"]', (e) =>
this.ui.on('change', 'input[type="checkbox"],select', (e) =>
this.onSettingsChange(e),
);
this.ui.on('keypress blur', 'textarea[name="customhighlight"]', (e) =>
Expand Down Expand Up @@ -117,7 +117,6 @@ export default class ChatSettingsMenu extends ChatMenu {
}
if (
e.getAttribute('type') === 'text' ||
e.getAttribute('type') === 'number' ||
e.nodeName.toLocaleLowerCase() === 'select'
) {
return $(e).val();
Expand All @@ -133,7 +132,6 @@ export default class ChatSettingsMenu extends ChatMenu {
);
} else if (
e.getAttribute('type') === 'text' ||
e.getAttribute('type') === 'number' ||
e.nodeName.toLocaleLowerCase() === 'select'
) {
$(e).val(val);
Expand Down
6 changes: 0 additions & 6 deletions assets/views/embed.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ <h4>Autocomplete</h4>
Auto-complete helper
</label>
</div>

<h4>Links</h4>
<div class="form-group">
<label for="linksize">Link Hitbox Scale</label>
<input class="form-control" name="linksize" type="number" placeholder="1" step="0.25" min="1" />
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit b49f0c9

Please sign in to comment.