Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

[Release] Dynamic max and min zoom in the new ImageView #5925

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6f794cc
Fill in some metadata for the sent event
turt2live Apr 15, 2021
7d95621
Replace deprecated processor with a worklet
turt2live Apr 20, 2021
61730f2
Populate waveform data on voice message event
turt2live Apr 20, 2021
4f75e29
Appease the linter
turt2live Apr 20, 2021
c30b62e
Fix alignment issue with nested spaces being cut off wrong
t3chguy Apr 20, 2021
b519d85
Update src/voice/RecorderWorklet.ts to use sanity
turt2live Apr 20, 2021
6082891
Iterate the spaces face pile design
t3chguy Apr 22, 2021
90cd5d0
Remove old redundant hover effect
t3chguy Apr 22, 2021
ee80c27
Improve edge cases with spaces context switching
t3chguy Apr 22, 2021
e1ba047
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy Apr 22, 2021
ec0612f
Fix spaces notification dots wrongly including upgraded (hidden) rooms
t3chguy Apr 22, 2021
c0f8098
Merge pull request #5890 from matrix-org/t3chguy/fix/17006
t3chguy Apr 22, 2021
b64b956
when automatically switching space to match room fall back to the hom…
t3chguy Apr 22, 2021
28fa1cb
Reset space contexts as some users may have loops stuck in their loca…
t3chguy Apr 22, 2021
ca07b1e
Update res/css/views/elements/_FacePile.scss
t3chguy Apr 22, 2021
23c6175
Add comment
t3chguy Apr 22, 2021
1305659
Merge branch 't3chguy/fix/16976' of github.com:matrix-org/matrix-reac…
t3chguy Apr 22, 2021
d9dac7b
Merge pull request #5898 from matrix-org/t3chguy/fix/16976
t3chguy Apr 22, 2021
60ef657
Properly hide spaces from the room list
t3chguy Apr 22, 2021
7efd4a4
Show space invites at the top of the space panel
t3chguy Apr 22, 2021
a51aeaa
Disable context menu on space invite tiles as no options sensibly work
t3chguy Apr 22, 2021
108a308
Hide explore rooms quick action when active space is an invite
t3chguy Apr 22, 2021
e052002
fix comment
t3chguy Apr 22, 2021
e219fe0
Tweak context switching edge case for space invites
t3chguy Apr 22, 2021
b332f6b
Use floats for image background opacity
jryans Apr 22, 2021
5c93b99
Merge pull request #5900 from matrix-org/t3chguy/fix/17024
t3chguy Apr 22, 2021
3fb4b62
Merge pull request #5899 from matrix-org/t3chguy/spaces-stability
t3chguy Apr 22, 2021
ba9cfa0
Merge pull request #5902 from matrix-org/t3chguy/fix/17020
t3chguy Apr 22, 2021
21e7847
Merge pull request #5905 from matrix-org/jryans/image-bg-opacity
jryans Apr 22, 2021
14809df
Misc cleanup
turt2live Apr 22, 2021
2b6551d
Remove reliance on DOM API to generated message preview
germain-gg Apr 22, 2021
cc5a767
Keep invite button separate from space info
robintown Apr 22, 2021
06726d3
Merge pull request #5888 from matrix-org/travis/voice/event_type
turt2live Apr 22, 2021
a3e8466
Add array utility tests (and support upsampling in resample)
turt2live Apr 22, 2021
772ff4e
Add object utility tests
turt2live Apr 23, 2021
21cae15
Add map utility tests
turt2live Apr 23, 2021
0d4218e
Add enum utility tests
turt2live Apr 23, 2021
6124a83
Add iterable utility tests
turt2live Apr 23, 2021
27af329
Add number utility tests
turt2live Apr 23, 2021
374f514
Add set utility tests
turt2live Apr 23, 2021
2c459c4
Move utility tests to the right place
turt2live Apr 23, 2021
c09d4f4
Merge pull request #5904 from SimonBrandner/normalize-wheel
jryans Apr 23, 2021
65d55bd
Merge pull request #5908 from matrix-org/gsouquet-messagepreview-nodom
germain-gg Apr 23, 2021
024cf7f
Cut off long names in add rooms to space dialog
robintown Apr 22, 2021
0f84b3d
Align checkboxes with names in add rooms to space dialog
robintown Apr 22, 2021
3d7842d
Remove old FormButton CSS
robintown Apr 22, 2021
002c24e
Merge branch 'develop' into spaces-visual-fixes
robintown Apr 23, 2021
e088118
Merge pull request #5909 from robintown/spaces-visual-fixes
t3chguy Apr 23, 2021
09af2a8
Merge pull request #5910 from matrix-org/travis/tests/array-obj-utils
turt2live Apr 23, 2021
dad7a22
Initial code for dynamic minZoom
SimonBrandner Apr 24, 2021
4523b8c
Add dynamic maxZoom and wire it all up
SimonBrandner Apr 24, 2021
f8af983
Don't use percanteages
SimonBrandner Apr 24, 2021
57b34f8
Get rid of onWindowResize()
SimonBrandner Apr 24, 2021
e0e9ccb
Remove logline
SimonBrandner Apr 24, 2021
dcc060f
Use correct cursor when we can't zoom
SimonBrandner Apr 24, 2021
1a906c9
Merge branch 'develop' into image-view-zoom
SimonBrandner Apr 24, 2021
9b7a9fc
Use MAX_SCALE for maxZoom
SimonBrandner Apr 24, 2021
bcc6e5c
Add some comments
SimonBrandner Apr 24, 2021
90f2423
Fix zoom step and coeficient
SimonBrandner Apr 24, 2021
0e31297
Rework zooming
SimonBrandner Apr 24, 2021
c1a4204
Use a ref instead of that ugly thing
SimonBrandner Apr 26, 2021
33107a1
Fall back to natural height and width
SimonBrandner Apr 26, 2021
b741b31
If the image is small don't scale
SimonBrandner Apr 26, 2021
dbca370
Try to precalculate the zoom from width and height props
SimonBrandner Apr 26, 2021
e374fcf
Fix spelling
SimonBrandner Apr 26, 2021
3547d1f
Change cursor to default
SimonBrandner Apr 26, 2021
53e8b5e
Merge branch 'image-view-zoom' of https://github.com/SimonBrandner/ma…
SimonBrandner Apr 26, 2021
1fcad1a
Show zoom buttons only if zooming is enabled
SimonBrandner Apr 26, 2021
38566a3
i18n
SimonBrandner Apr 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions res/css/structures/_SpacePanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $activeBorderColor: $secondary-fg-color;

.mx_SpacePanel_spaceTreeWrapper {
flex: 1;
overflow-y: scroll;
padding: 8px 8px 16px 0;
}

.mx_SpacePanel_toggleCollapse {
Expand All @@ -59,11 +59,10 @@ $activeBorderColor: $secondary-fg-color;
margin: 0;
list-style: none;
padding: 0;
padding-left: 16px;
}

.mx_AutoHideScrollbar {
padding: 8px 0 16px;
> .mx_SpaceItem {
padding-left: 16px;
}
}

.mx_SpaceButton_toggleCollapse {
Expand Down
32 changes: 1 addition & 31 deletions res/css/structures/_SpaceRoomView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -214,45 +214,15 @@ $SpaceRoomViewInnerWidth: 428px;

.mx_SpaceRoomView_info {
display: inline-block;
margin: 0;
margin: 0 auto 0 0;
}

.mx_FacePile {
display: inline-block;
margin-left: auto;
margin-right: 12px;

.mx_FacePile_faces {
cursor: pointer;

> span:hover {
.mx_BaseAvatar {
filter: brightness(0.8);
}
}

> span:first-child {
position: relative;

.mx_BaseAvatar {
filter: brightness(0.8);
}

&::before {
content: "";
z-index: 1;
position: absolute;
top: 0;
left: 0;
height: 30px;
width: 30px;
background: #ffffff; // white icon fill
mask-position: center;
mask-size: 24px;
mask-repeat: no-repeat;
mask-image: url('$(res)/img/element-icons/room/ellipsis.svg');
}
}
}
}

Expand Down
14 changes: 6 additions & 8 deletions res/css/views/dialogs/_AddExistingToSpaceDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ limitations under the License.
font-size: $font-15px;
line-height: 30px;
flex-grow: 1;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-right: 12px;
}

.mx_FormButton {
min-width: 92px;
font-weight: normal;
box-sizing: border-box;
.mx_Checkbox {
align-items: center;
}
}
}
Expand Down Expand Up @@ -192,8 +194,4 @@ limitations under the License.
padding: 0;
}
}

.mx_FormButton {
padding: 8px 22px;
}
}
27 changes: 25 additions & 2 deletions res/css/views/elements/_FacePile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
flex-direction: row-reverse;
vertical-align: middle;

> span + span {
> .mx_FacePile_face + .mx_FacePile_face {
margin-right: -8px;
}

Expand All @@ -31,9 +31,32 @@ limitations under the License.
.mx_BaseAvatar_initial {
margin: 1px; // to offset the border on the image
}

.mx_FacePile_more {
position: relative;
border-radius: 100%;
width: 30px;
height: 30px;
background-color: $groupFilterPanel-bg-color;

&::before {
content: "";
z-index: 1;
position: absolute;
top: 0;
left: 0;
height: inherit;
width: inherit;
background: $tertiary-fg-color;
mask-position: center;
mask-size: 20px;
mask-repeat: no-repeat;
mask-image: url('$(res)/img/element-icons/room/ellipsis.svg');
}
}
}

> span {
.mx_FacePile_summary {
margin-left: 12px;
font-size: $font-14px;
line-height: $font-24px;
Expand Down
3 changes: 1 addition & 2 deletions res/css/views/elements/_ImageView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ limitations under the License.

.mx_ImageView_image {
pointer-events: all;
max-width: 95%;
max-height: 95%;
flex-shrink: 0;
}

.mx_ImageView_panel {
Expand Down
2 changes: 1 addition & 1 deletion res/themes/dark/css/_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $dialog-close-fg-color: #9fa9ba;

$dialog-background-bg-color: $header-panel-bg-color;
$lightbox-background-bg-color: #000;
$lightbox-background-bg-opacity: 85%;
$lightbox-background-bg-opacity: 0.85;

$settings-grey-fg-color: #a2a2a2;
$settings-profile-placeholder-bg-color: #21262c;
Expand Down
2 changes: 1 addition & 1 deletion res/themes/legacy-dark/css/_legacy-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ $dialog-close-fg-color: #9fa9ba;

$dialog-background-bg-color: $header-panel-bg-color;
$lightbox-background-bg-color: #000;
$lightbox-background-bg-opacity: 85%;
$lightbox-background-bg-opacity: 0.85;

$settings-grey-fg-color: #a2a2a2;
$settings-profile-placeholder-bg-color: #e7e7e7;
Expand Down
2 changes: 1 addition & 1 deletion res/themes/legacy-light/css/_legacy-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ $dialog-close-fg-color: #c1c1c1;

$dialog-background-bg-color: #e9e9e9;
$lightbox-background-bg-color: #000;
$lightbox-background-bg-opacity: 95%;
$lightbox-background-bg-opacity: 0.95;

$imagebody-giflabel: rgba(0, 0, 0, 0.7);
$imagebody-giflabel-border: rgba(0, 0, 0, 0.2);
Expand Down
2 changes: 1 addition & 1 deletion res/themes/light/css/_light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ $dialog-close-fg-color: #c1c1c1;

$dialog-background-bg-color: #e9e9e9;
$lightbox-background-bg-color: #000;
$lightbox-background-bg-opacity: 95%;
$lightbox-background-bg-opacity: 0.95;

$imagebody-giflabel: rgba(0, 0, 0, 0.7);
$imagebody-giflabel-border: rgba(0, 0, 0, 0.2);
Expand Down
26 changes: 26 additions & 0 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,30 @@ declare global {
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/columnNumber
columnNumber?: number;
}

// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
interface AudioWorkletProcessor {
readonly port: MessagePort;
process(
inputs: Float32Array[][],
outputs: Float32Array[][],
parameters: Record<string, Float32Array>
): boolean;
}

// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
const AudioWorkletProcessor: {
prototype: AudioWorkletProcessor;
new (options?: AudioWorkletNodeOptions): AudioWorkletProcessor;
};

// https://github.com/microsoft/TypeScript/issues/28308#issuecomment-650802278
function registerProcessor(
name: string,
processorCtor: (new (
options?: AudioWorkletNodeOptions
) => AudioWorkletProcessor) & {
parameterDescriptors?: AudioParamDescriptor[];
}
);
}
13 changes: 8 additions & 5 deletions src/HtmlUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ export function sanitizedHtmlNode(insaneHtml: string) {
return <div dangerouslySetInnerHTML={{ __html: saneHtml }} dir="auto" />;
}

export function sanitizedHtmlNodeInnerText(insaneHtml: string) {
const saneHtml = sanitizeHtml(insaneHtml, sanitizeHtmlParams);
const contentDiv = document.createElement("div");
contentDiv.innerHTML = saneHtml;
return contentDiv.innerText;
export function getHtmlText(insaneHtml: string) {
return sanitizeHtml(insaneHtml, {
allowedTags: [],
allowedAttributes: {},
selfClosing: [],
allowedSchemes: [],
disallowedTagsMode: 'discard',
})
}

/**
Expand Down
47 changes: 35 additions & 12 deletions src/components/views/elements/FacePile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { HTMLAttributes } from "react";
import React, { HTMLAttributes, ReactNode, useContext } from "react";
import { Room } from "matrix-js-sdk/src/models/room";
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import { sortBy } from "lodash";
Expand All @@ -24,6 +24,7 @@ import { _t } from "../../../languageHandler";
import DMRoomMap from "../../../utils/DMRoomMap";
import TextWithTooltip from "../elements/TextWithTooltip";
import { useRoomMembers } from "../../../hooks/useRoomMembers";
import MatrixClientContext from "../../../contexts/MatrixClientContext";

const DEFAULT_NUM_FACES = 5;

Expand All @@ -36,6 +37,7 @@ interface IProps extends HTMLAttributes<HTMLSpanElement> {
const isKnownMember = (member: RoomMember) => !!DMRoomMap.shared().getDMRoomsForUserId(member.userId)?.length;

const FacePile = ({ room, onlyKnownUsers = true, numShown = DEFAULT_NUM_FACES, ...props }: IProps) => {
const cli = useContext(MatrixClientContext);
let members = useRoomMembers(room);

// sort users with an explicit avatar first
Expand All @@ -46,21 +48,42 @@ const FacePile = ({ room, onlyKnownUsers = true, numShown = DEFAULT_NUM_FACES, .
// sort known users first
iteratees.unshift(member => isKnownMember(member));
}
if (members.length < 1) return null;

const shownMembers = sortBy(members, iteratees).slice(0, numShown);
// exclude ourselves from the shown members list
const shownMembers = sortBy(members.filter(m => m.userId !== cli.getUserId()), iteratees).slice(0, numShown);
if (shownMembers.length < 1) return null;

// We reverse the order of the shown faces in CSS to simplify their visual overlap,
// reverse members in tooltip order to make the order between the two match up.
const commaSeparatedMembers = shownMembers.map(m => m.rawDisplayName).reverse().join(", ");

let tooltip: ReactNode;
if (props.onClick) {
tooltip = <div>
<div className="mx_Tooltip_title">
{ _t("View all %(count)s members", { count: members.length }) }
</div>
<div className="mx_Tooltip_sub">
{ _t("Including %(commaSeparatedMembers)s", { commaSeparatedMembers }) }
</div>
</div>;
} else {
tooltip = _t("%(count)s members including %(commaSeparatedMembers)s", {
count: members.length,
commaSeparatedMembers,
});
}

return <div {...props} className="mx_FacePile">
<div className="mx_FacePile_faces">
{ shownMembers.map(member => {
return <TextWithTooltip key={member.userId} tooltip={member.name}>
<MemberAvatar member={member} width={28} height={28} />
</TextWithTooltip>;
}) }
</div>
{ onlyKnownUsers && <span>
<TextWithTooltip class="mx_FacePile_faces" tooltip={tooltip} tooltipProps={{ yOffset: 32 }}>
{ members.length > numShown ? <span className="mx_FacePile_face mx_FacePile_more" /> : null }
{ shownMembers.map(m =>
<MemberAvatar key={m.userId} member={m} width={28} height={28} className="mx_FacePile_face" /> )}
</TextWithTooltip>
{ onlyKnownUsers && <span className="mx_FacePile_summary">
{ _t("%(count)s people you know have already joined", { count: members.length }) }
</span> }
</div>
</div>;
};

export default FacePile;
Loading