-
-
Notifications
You must be signed in to change notification settings - Fork 834
Zoom/scale setting #1651
Zoom/scale setting #1651
Changes from 1 commit
c1c2944
af86415
834b03e
23a38e6
c37817e
cd8eba7
0421f9a
37802e1
ede442e
a11ada1
4511e69
20dae9c
18cf921
bbccc26
3eacee0
e6acc65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
Copyright 2017 Marcel Radzio (MTRNord) | ||
Copyright 2017 Vector Creations Ltd. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^^ this needs fixing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should this be changed to? This was a copy from another component. Should I be putting it under my own name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, unless someone else wrote it :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok 😄 and also remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done 😃 hope my name is not taking too much space in the repo |
||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import sdk from '../../../index'; | ||
import SettingsStore from "../../../settings/SettingsStore"; | ||
|
||
export default class InterfaceScaleSlider extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this._onValueChange = this._onValueChange.bind(this); | ||
} | ||
|
||
componentWillMount() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no point having an empty willMount There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry about the goofs 🙂 updated those now |
||
} | ||
|
||
_onValueChange(e) { | ||
this.props.onValueChange(parseInt(e.target.value)); | ||
} | ||
|
||
render() { | ||
let interfaceScale = SettingsStore.getValue("interfaceScale", null, /*excludeDefault:*/true); | ||
let value = this.props.value || interfaceScale; | ||
return <div> | ||
<input type="range" min="50" max="150" step="25" className={this.props.className} | ||
onChange={this._onValueChange} value={value} /> | ||
{value}% | ||
</div> | ||
} | ||
} | ||
|
||
InterfaceScaleSlider.propTypes = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can be moved into the body of the class as
|
||
className: React.PropTypes.string, | ||
onValueChange: React.PropTypes.func.isRequired, | ||
value: React.PropTypes.number, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing scale yielding a full reload is really bad UX :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Just a copy from language setting to start with. What would you prefer happen? Options:
If 2 is preferable, is there a way in this sdk to watch a state change (scale changing) on the root element? Maybe
SettingsManager
has a watch function? Or is the only way to bubble up the change through the component tree?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use the dispatcher to send a
zoom_change
event that LoggedInView/MatrixChat listens on and acts on when you save the setting