From 6b08cd2355f0004db02da5c0c942c3d2f51df034 Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 26 Aug 2021 21:14:20 +0530 Subject: [PATCH] Aliasing toggle button (#1132) --- src/client/lazy-app/Compress/Output/index.tsx | 47 ++++++++++++++++--- src/client/lazy-app/Compress/Output/style.css | 8 +++- src/client/lazy-app/icons/index.tsx | 19 ++++++++ src/client/lazy-app/util/index.ts | 9 ++-- 4 files changed, 71 insertions(+), 12 deletions(-) diff --git a/src/client/lazy-app/Compress/Output/index.tsx b/src/client/lazy-app/Compress/Output/index.tsx index 58d5ba3f..511ecfea 100644 --- a/src/client/lazy-app/Compress/Output/index.tsx +++ b/src/client/lazy-app/Compress/Output/index.tsx @@ -5,8 +5,10 @@ import './custom-els/PinchZoom'; import './custom-els/TwoUp'; import * as style from './style.css'; import 'add-css:./style.css'; -import { isSafari, shallowEqual } from '../../util'; +import { shallowEqual, isSafari } from '../../util'; import { + ToggleAliasingIcon, + ToggleAliasingActiveIcon, ToggleBackgroundIcon, AddIcon, RemoveIcon, @@ -34,6 +36,7 @@ interface State { scale: number; editingScale: boolean; altBackground: boolean; + aliasing: boolean; } const scaleToOpts: ScaleToOpts = { @@ -48,6 +51,7 @@ export default class Output extends Component { scale: 1, editingScale: false, altBackground: false, + aliasing: false, }; canvasLeft?: HTMLCanvasElement; canvasRight?: HTMLCanvasElement; @@ -144,6 +148,12 @@ export default class Output extends Component { return props.rightCompressed || (props.source && props.source.preprocessed); } + private toggleAliasing = () => { + this.setState((state) => ({ + aliasing: !state.aliasing, + })); + }; + private toggleBackground = () => { this.setState({ altBackground: !this.state.altBackground, @@ -254,7 +264,7 @@ export default class Output extends Component { render( { mobileView, leftImgContain, rightImgContain, source }: Props, - { scale, editingScale, altBackground }: State, + { scale, editingScale, altBackground, aliasing }: State, ) { const leftDraw = this.leftDrawable(); const rightDraw = this.rightDrawable(); @@ -288,7 +298,9 @@ export default class Output extends Component { ref={linkRef(this, 'pinchZoomLeft')} > { ref={linkRef(this, 'pinchZoomRight')} > {
- - + )} +