Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
8aabe1f
Reorganized elements
SimonBrandner Dec 19, 2020
2040815
Implement zooming
SimonBrandner Dec 19, 2020
3c306bc
Added icons
SimonBrandner Dec 19, 2020
b9f480a
Remove flex property
SimonBrandner Dec 19, 2020
2c5f3f3
Fixed Chromium issues - made listner non-passive
SimonBrandner Dec 19, 2020
633221f
Center image
SimonBrandner Dec 19, 2020
ae25ff8
Switched to scale
SimonBrandner Dec 19, 2020
ec5fcaf
Added a comment
SimonBrandner Dec 20, 2020
be9b68a
Use height and width properties for scaling again
SimonBrandner Dec 20, 2020
8de019c
Added some padding
SimonBrandner Dec 20, 2020
f9884b1
Implement translation
SimonBrandner Dec 20, 2020
7dd7aef
Remove imageBox
SimonBrandner Dec 20, 2020
6758734
Remove panel element
SimonBrandner Dec 20, 2020
18de342
Fixed translation issue while the image is rotated
SimonBrandner Dec 20, 2020
776b0e8
Change comment styling
SimonBrandner Dec 20, 2020
f0abd52
Remove the need to press ctrl while zooming
SimonBrandner Dec 20, 2020
cbfa6c5
Fix some sizing issues
SimonBrandner Dec 20, 2020
61c5e7e
Reorder label items
SimonBrandner Dec 20, 2020
0dff150
Fix some more sizing issues
SimonBrandner Dec 20, 2020
096fb33
Always allow moving
SimonBrandner Dec 20, 2020
3d62138
Set max zoom
SimonBrandner Dec 20, 2020
f771b7a
Added zoom button
SimonBrandner Dec 20, 2020
6315c8e
Fix formatting
SimonBrandner Dec 20, 2020
00bc97b
i18n
SimonBrandner Dec 20, 2020
997e08f
Reorganize buttons
SimonBrandner Dec 21, 2020
743b91d
Merge branch 'develop' into improve-image-view
SimonBrandner Dec 21, 2020
ad5844f
Fix i18n
SimonBrandner Dec 21, 2020
e2abbf9
Merge branch 'develop' into improve-image-view
SimonBrandner Jan 23, 2021
87d5d73
Merge branch 'develop' into improve-image-view
SimonBrandner Feb 23, 2021
e5d6814
Remove zoom icon
SimonBrandner Feb 23, 2021
35663c3
Reorder the icons according to the design
SimonBrandner Feb 23, 2021
6cf19e8
Update icons according to the design
SimonBrandner Feb 23, 2021
d85ab38
Reorganize elements
SimonBrandner Feb 24, 2021
05e9019
Remove name
SimonBrandner Feb 24, 2021
4971318
Remove size info
SimonBrandner Feb 24, 2021
768d268
Fix css
SimonBrandner Feb 24, 2021
ab79deb
Update the looks a bit more
SimonBrandner Feb 24, 2021
899ce1f
Partially fix overflow issues
SimonBrandner Feb 24, 2021
6aac8f1
Change padding a bit
SimonBrandner Feb 24, 2021
13d7662
Remove redact button
SimonBrandner Feb 24, 2021
8454a2d
Remove padding on lightboxes
SimonBrandner Feb 24, 2021
3e408b3
Remove unused code
SimonBrandner Feb 24, 2021
7cd8f11
Quit on empty panel click
SimonBrandner Feb 24, 2021
fafb8d4
Fix padding according to the design
SimonBrandner Feb 24, 2021
a6bb203
Redo icons
SimonBrandner Feb 24, 2021
b068a4c
Make download into a button
SimonBrandner Feb 24, 2021
0a00ffa
Add more icon
SimonBrandner Feb 24, 2021
83e1a7a
Add more button
SimonBrandner Feb 24, 2021
fa9ae89
Don't show info if no event
SimonBrandner Feb 24, 2021
bd5efc7
Pass permallinkCreator to ImageView
SimonBrandner Feb 24, 2021
9312bec
Add context menu
SimonBrandner Feb 24, 2021
81698a2
Fix pointer-events
SimonBrandner Feb 24, 2021
2021e4e
Remove ugly workaround
SimonBrandner Feb 24, 2021
7293181
i18n
SimonBrandner Feb 24, 2021
9838952
Update info
SimonBrandner Feb 24, 2021
6008a6f
Use showTwelveHourTimestamps
SimonBrandner Feb 24, 2021
649b87a
Make permalink clickable
SimonBrandner Feb 24, 2021
25873c8
Remove rounded border
SimonBrandner Feb 24, 2021
d58c17f
Show grabbing cursor
SimonBrandner Feb 25, 2021
fe8e90f
Change comment styling
SimonBrandner Feb 25, 2021
5a9e1a1
Fix close icon
SimonBrandner Feb 25, 2021
83de849
Close onPermalinkClicked
SimonBrandner Feb 25, 2021
b18622e
Show full date
SimonBrandner Feb 25, 2021
273753a
Fix hex formatting
SimonBrandner Feb 25, 2021
a4130cb
Revert trash icon
SimonBrandner Feb 25, 2021
7fc3758
Add newline
SimonBrandner Feb 25, 2021
984b437
Remove trash red icon
SimonBrandner Feb 25, 2021
4f3fe3d
Add comments
SimonBrandner Feb 25, 2021
d0dea91
contextMenuDisplay -> contextMenuDisplayed
SimonBrandner Feb 25, 2021
fa239e5
ZOOM shouldn't be a part of the class
SimonBrandner Feb 25, 2021
80ce4da
Remove onRedactClick
SimonBrandner Feb 25, 2021
4c377ae
Consistent evs
SimonBrandner Feb 25, 2021
436a17b
Remove imports
SimonBrandner Feb 25, 2021
dc28324
Remove wrapper
SimonBrandner Feb 25, 2021
1955fff
CSS cleanup
SimonBrandner Feb 25, 2021
fc32cea
i18n
SimonBrandner Feb 25, 2021
b27a8e3
Merge branch 'develop' into improve-image-view
SimonBrandner Mar 14, 2021
9c31385
Increase defautl size
SimonBrandner Mar 15, 2021
67a57ea
Export ZOOM_STEP into a variable
SimonBrandner Mar 15, 2021
7b6d393
Add a missing space
SimonBrandner Mar 15, 2021
e450355
Add ZOOM_COEFFICIENT with value of 10
SimonBrandner Mar 15, 2021
8f6f9cd
Remove some unnecessary CSS and set MIN_ZOOM to 95
SimonBrandner Mar 15, 2021
c96d262
Set max-width and MIN_ZOOM
SimonBrandner Mar 16, 2021
9606297
Merge branch 'develop' into improve-image-view
SimonBrandner Apr 2, 2021
e5a563f
Close ImageView after forward click
SimonBrandner Apr 2, 2021
535ae08
Make sender bold
SimonBrandner Apr 2, 2021
12b3661
Set color-hex-case to null
SimonBrandner Apr 2, 2021
e79254e
Set opacity of lightboxes to 95 in light theme
SimonBrandner Apr 2, 2021
80854ab
Don't show seconds in ImageView
SimonBrandner Apr 2, 2021
eb83ae0
Use MIN_ZOOM in contructor
SimonBrandner Apr 2, 2021
33a1006
Iterate mouse actions and cursor behaviour
SimonBrandner Apr 2, 2021
7068996
Animate zooming
SimonBrandner Apr 2, 2021
2ff3400
Reset translation with zoom out
SimonBrandner Apr 2, 2021
722178e
Don't return false
SimonBrandner Apr 2, 2021
429c945
Don't allow translation when zoomed out
SimonBrandner Apr 2, 2021
12a36d1
This is hopefully not true anymore
SimonBrandner Apr 2, 2021
fd8e785
Why don't I convert this to Typescript while I am here?
SimonBrandner Apr 3, 2021
88a881b
ZOOM_DISTANCE into a const
SimonBrandner Apr 3, 2021
cb02c39
Add name to copyright
SimonBrandner Apr 9, 2021
4a40f67
Make private
SimonBrandner Apr 9, 2021
90f9d20
Add comment about refs to functional components
SimonBrandner Apr 9, 2021
7f496c7
Add comment: same on all themes
SimonBrandner Apr 9, 2021
b723092
Add null check
SimonBrandner Apr 9, 2021
829bef4
Close dialog on redact
SimonBrandner Apr 9, 2021
86dd81c
Fix rotation animation when rotating 360 deg
SimonBrandner Apr 9, 2021
f1c80fc
Call onCloseDialog straigh away
SimonBrandner Apr 13, 2021
e1446f0
Make ImageView static
SimonBrandner Apr 13, 2021
b1091a2
Don't render context menu button if mxEvent is missing
SimonBrandner Apr 13, 2021
f9fde36
Set target to _blank
SimonBrandner Apr 13, 2021
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
"stylelint-scss",
],
"rules": {
"color-hex-case": null,
"indentation": 4,
"comment-empty-line-before": null,
"declaration-empty-line-before": null,
Expand Down
3 changes: 2 additions & 1 deletion res/css/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
}

.mx_Dialog_lightbox .mx_Dialog_background {
opacity: 0.85;
opacity: $lightbox-background-bg-opacity;
background-color: $lightbox-background-bg-color;
}

Expand All @@ -315,6 +315,7 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
max-width: 100%;
max-height: 100%;
pointer-events: none;
padding: 0;
}

.mx_Dialog_header {
Expand Down
161 changes: 65 additions & 96 deletions res/css/views/elements/_ImageView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,139 +14,108 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

/* This has got to be the most fragile piece of CSS ever written.
But empirically it works on Chrome/FF/Safari
*/

.mx_ImageView {
display: flex;
width: 100%;
height: 100%;
align-items: center;
}

.mx_ImageView_lhs {
order: 1;
flex: 1 1 10%;
min-width: 60px;
// background-color: #080;
// height: 20px;
flex-direction: column;
}

.mx_ImageView_content {
order: 2;
/* min-width hack needed for FF */
min-width: 0px;
height: 90%;
flex: 15 15 0;
.mx_ImageView_image_wrapper {
display: flex;
align-items: center;
justify-content: center;
align-items: center;
height: 100%;
overflow: hidden;
}

.mx_ImageView_content img {
max-width: 100%;
/* XXX: max-height interacts badly with flex on Chrome and doesn't relayout properly until you refresh */
max-height: 100%;
/* object-fit hack needed for Chrome due to Chrome not re-laying-out until you refresh */
object-fit: contain;
/* background-image: url('$(res)/img/trans.png'); */
.mx_ImageView_image {
pointer-events: all;
max-width: 95%;
max-height: 95%;
}

.mx_ImageView_labelWrapper {
position: absolute;
top: 0px;
right: 0px;
height: 100%;
overflow: auto;
pointer-events: all;
.mx_ImageView_panel {
width: 100%;
height: 68px;
display: flex;
justify-content: space-between;
align-items: center;
}

.mx_ImageView_label {
text-align: left;
.mx_ImageView_info_wrapper {
pointer-events: all;
padding-left: 32px;
display: flex;
justify-content: center;
flex-direction: column;
padding-left: 30px;
padding-right: 30px;
min-height: 100%;
max-width: 240px;
flex-direction: row;
align-items: center;
color: $lightbox-fg-color;
}

.mx_ImageView_cancel {
position: absolute;
// hack for mx_Dialog having a top padding of 40px
top: 40px;
right: 0px;
padding-top: 35px;
padding-right: 35px;
cursor: pointer;
.mx_ImageView_info {
padding-left: 12px;
display: flex;
flex-direction: column;
}

.mx_ImageView_rotateClockwise {
position: absolute;
top: 40px;
right: 70px;
padding-top: 35px;
cursor: pointer;
.mx_ImageView_info_sender {
font-weight: bold;
}

.mx_ImageView_rotateCounterClockwise {
position: absolute;
top: 40px;
right: 105px;
padding-top: 35px;
cursor: pointer;
.mx_ImageView_toolbar {
padding-right: 16px;
pointer-events: all;
display: flex;
align-items: center;
}

.mx_ImageView_name {
font-size: $font-18px;
margin-bottom: 6px;
word-wrap: break-word;
.mx_ImageView_button {
margin-left: 24px;
display: block;

&::before {
content: '';
height: 22px;
width: 22px;
mask-repeat: no-repeat;
mask-size: contain;
mask-position: center;
display: block;
background-color: $icon-button-color;
}
}

.mx_ImageView_metadata {
font-size: $font-15px;
opacity: 0.5;
.mx_ImageView_button_rotateCW::before {
mask-image: url('$(res)/img/image-view/rotate-cw.svg');
}

.mx_ImageView_download {
display: table;
margin-top: 24px;
margin-bottom: 6px;
border-radius: 5px;
background-color: $lightbox-bg-color;
font-size: $font-14px;
padding: 9px;
border: 1px solid $lightbox-border-color;
.mx_ImageView_button_rotateCCW::before {
mask-image: url('$(res)/img/image-view/rotate-ccw.svg');
}

.mx_ImageView_size {
font-size: $font-11px;
.mx_ImageView_button_zoomOut::before {
mask-image: url('$(res)/img/image-view/zoom-out.svg');
}

.mx_ImageView_link {
color: $lightbox-fg-color !important;
text-decoration: none !important;
.mx_ImageView_button_zoomIn::before {
mask-image: url('$(res)/img/image-view/zoom-in.svg');
}

.mx_ImageView_button {
font-size: $font-15px;
opacity: 0.5;
margin-top: 18px;
cursor: pointer;
.mx_ImageView_button_download::before {
mask-image: url('$(res)/img/image-view/download.svg');
}

.mx_ImageView_shim {
height: 30px;
.mx_ImageView_button_more::before {
mask-image: url('$(res)/img/image-view/more.svg');
}

.mx_ImageView_rhs {
order: 3;
flex: 1 1 10%;
min-width: 300px;
// background-color: #800;
// height: 20px;
.mx_ImageView_button_close {
border-radius: 100%;
background: #21262c; // same on all themes
&::before {
width: 32px;
height: 32px;
mask-image: url('$(res)/img/image-view/close.svg');
mask-size: 40%;
}
}
10 changes: 0 additions & 10 deletions res/img/cancel-white.svg

This file was deleted.

3 changes: 3 additions & 0 deletions res/img/image-view/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/more.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/rotate-ccw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/rotate-cw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/zoom-in.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/img/image-view/zoom-out.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion res/img/rotate-ccw.svg

This file was deleted.

1 change: 0 additions & 1 deletion res/img/rotate-cw.svg

This file was deleted.

3 changes: 2 additions & 1 deletion res/themes/dark/css/_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +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%;

$settings-grey-fg-color: #a2a2a2;
$settings-profile-placeholder-bg-color: #21262c;
Expand Down Expand Up @@ -242,7 +243,7 @@ $composer-shadow-color: rgba(0, 0, 0, 0.28);
@define-mixin mx_DialogButton_secondary {
// flip colours for the secondary ones
font-weight: 600;
border: 1px solid $accent-color ! important;
border: 1px solid $accent-color !important;
color: $accent-color;
background-color: $button-secondary-bg-color;
}
Expand Down
1 change: 1 addition & 0 deletions res/themes/legacy-dark/css/_legacy-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +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%;

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

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

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

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

$imagebody-giflabel: rgba(0, 0, 0, 0.7);
$imagebody-giflabel-border: rgba(0, 0, 0, 0.2);
Expand Down
4 changes: 2 additions & 2 deletions src/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ export function formatFullDateNoTime(date: Date): string {
});
}

export function formatFullDate(date: Date, showTwelveHour = false): string {
export function formatFullDate(date: Date, showTwelveHour = false, showSeconds = true): string {
const days = getDaysArray();
const months = getMonthsArray();
return _t('%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s', {
weekDayName: days[date.getDay()],
monthName: months[date.getMonth()],
day: date.getDate(),
fullYear: date.getFullYear(),
time: formatFullTime(date, showTwelveHour),
time: showSeconds ? formatFullTime(date, showTwelveHour) : formatTime(date, showTwelveHour),
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/views/avatars/RoomAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default class RoomAvatar extends React.Component<IProps, IState> {
name: this.props.room.name,
};

Modal.createDialog(ImageView, params, "mx_Dialog_lightbox");
Modal.createDialog(ImageView, params, "mx_Dialog_lightbox", null, true);
};

public render() {
Expand Down
5 changes: 5 additions & 0 deletions src/components/views/context_menus/MessageContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export default class MessageContextMenu extends React.Component {

/* callback called when the menu is dismissed */
onFinished: PropTypes.func,

/* if the menu is inside a dialog, we sometimes need to close that dialog after click (forwarding) */
onCloseDialog: PropTypes.func,
};

state = {
Expand Down Expand Up @@ -141,6 +144,7 @@ export default class MessageContextMenu extends React.Component {

const cli = MatrixClientPeg.get();
try {
if (this.props.onCloseDialog) this.props.onCloseDialog();
await cli.redactEvent(
this.props.mxEvent.getRoomId(),
this.props.mxEvent.getId(),
Expand Down Expand Up @@ -190,6 +194,7 @@ export default class MessageContextMenu extends React.Component {
};

onForwardClick = () => {
if (this.props.onCloseDialog) this.props.onCloseDialog();
dis.dispatch({
action: 'forward_event',
event: this.props.mxEvent,
Expand Down
Loading