Skip to content
Open
8 changes: 7 additions & 1 deletion engine/src/ToolSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ Wick.ToolSettings = class {
type: 'color',
name: 'forwardOnionSkinTint',
default: new Wick.Color('rgba(0, 0, 255, .5)'),
},{
}, {
type: "boolean",
name: "imageSmoothing",
default: true
}, {
type: "choice",
name: 'brushMode',
default: 'none',
Expand All @@ -118,6 +122,8 @@ Wick.ToolSettings = class {
this._settings = {};
this._onSettingsChangedCallback = () => {};

this.project = null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this get added, and is it safe to other unchanged code?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.project = null
this.project = project || null;


this.resetAllSettings();
this.loadSettingsFromLocalstorage();
}
Expand Down
1 change: 1 addition & 0 deletions engine/src/base/Project.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Wick.Project = class extends Wick.Base {
this.activeTool = 'cursor';

this._toolSettings = new Wick.ToolSettings();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this._toolSettings = new Wick.ToolSettings();
this._toolSettings = new Wick.ToolSettings(this);

Example addressing this.

this._toolSettings.project = this

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to do this?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it simpler to just ask the project in the tool settings' constructor?

this._toolSettings.onSettingsChanged((name, value) => {
if (name === 'fillColor') {
this.selection.fillColor = value.rgba;
Expand Down
4 changes: 4 additions & 0 deletions engine/src/view/View.Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Wick.View.Path = class extends Wick.View {

this.importJSON(this.model.json);

if(this.model.pathType == 'image') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if clause gets called every frame, change it to a cached this._isImagePath

this.item.smoothing = this.model.project.toolSettings.getSetting('imageSmoothing')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache this also.

};

// Apply onion skin style if Needed
// (This is done here in the Path code because we actually change the style of the path
// if the current onion skin mode is set to "outlines" or "tint")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ class EditorSettings extends Component {
return (
<div className="editor-settings-modal-body">
<div className="editor-settings-group">
<label htmlFor="image-smoothing" className="editor-settings-group-title">Image Smoothing</label>
<WickInput
type="checkbox"
id="image-smoothing"
checked={this.props.getToolSetting('imageSmoothing')}
onChange={(bool) => {this.props.setToolSetting('imageSmoothing', bool.target.checked)}}
/>
<label htmlFor="clipboard-mode" className="editor-settings-group-title">Clipboard</label>
Mode:
<WickInput
Expand Down
1 change: 1 addition & 0 deletions src/Editor/Modals/SettingsModal/SettingsModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class SettingsModal extends Component {
lastColorsUsed={this.props.lastColorsUsed}
getToolSetting={this.props.getToolSetting}
setToolSetting={this.props.setToolSetting}
project={this.props.project}
toggle={this.props.toggle}
getToolSettingRestrictions={this.props.getToolSettingRestrictions}/>
</TabbedInterface>
Expand Down