diff --git a/engine/src/ToolSettings.js b/engine/src/ToolSettings.js index 597344ca0..cfa6ac3c0 100644 --- a/engine/src/ToolSettings.js +++ b/engine/src/ToolSettings.js @@ -103,7 +103,7 @@ Wick.ToolSettings = class { type: 'color', name: 'forwardOnionSkinTint', default: new Wick.Color('rgba(0, 0, 255, .5)'), - },{ + }, { type: "choice", name: 'brushMode', default: 'none', diff --git a/engine/src/base/Project.js b/engine/src/base/Project.js index f3c0e3085..6d1a6090d 100644 --- a/engine/src/base/Project.js +++ b/engine/src/base/Project.js @@ -28,6 +28,7 @@ Wick.Project = class extends Wick.Base { * @param {number} height - Project height in pixels. Default 480. * @param {number} framerate - Project framerate in frames-per-second. Default 12. * @param {Color} backgroundColor - Project background color in hex. Default #ffffff. + * @param {boolean} imageSmoothing - Whether to apply smoothing to project's images. */ constructor(args) { if (!args) args = {}; @@ -38,6 +39,7 @@ Wick.Project = class extends Wick.Base { this._height = args.height || 480; this._framerate = args.framerate || 12; this._backgroundColor = args.backgroundColor || new Wick.Color('#ffffff'); +this._imageSmoothing = !!args.imageSmoothing; this._hitTestOptions = this.getDefaultHitTestOptions(); this.pan = { x: 0, y: 0 }; @@ -227,6 +229,7 @@ Wick.Project = class extends Wick.Base { this.height = data.height; this.framerate = data.framerate; this.backgroundColor = new Wick.Color(data.backgroundColor); + this.imageSmoothing = data.imageSmoothing; this._focus = data.focus; @@ -248,6 +251,7 @@ Wick.Project = class extends Wick.Base { data.width = this.width; data.height = this.height; data.backgroundColor = this.backgroundColor.rgba; + data.imageSmoothing = this.imageSmoothing; data.framerate = this.framerate; data.onionSkinEnabled = this.onionSkinEnabled @@ -347,6 +351,19 @@ Wick.Project = class extends Wick.Base { this._backgroundColor = backgroundColor; } + /** + * Whether to apply image smoothing to project's images. + * @type {boolean} + */ + get imageSmoothing() { + return this._imageSmoothing; + } + + set imageSmoothing(imageSmoothing) { + // Apply image smoothing for old projects +this._imageSmoothing = !!imageSmoothing; + } + get hitTestOptions() { return this._hitTestOptions; } diff --git a/engine/src/view/View.Path.js b/engine/src/view/View.Path.js index 3709a4659..474e33156 100644 --- a/engine/src/view/View.Path.js +++ b/engine/src/view/View.Path.js @@ -49,6 +49,10 @@ Wick.View.Path = class extends Wick.View { this.importJSON(this.model.json); + if(this.item instanceof this.paper.Raster) { + this.item.smoothing = this.model.project.imageSmoothing; + }; + // 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") diff --git a/src/Editor/Modals/SettingsModal/ProjectSettings/ProjectSettings.jsx b/src/Editor/Modals/SettingsModal/ProjectSettings/ProjectSettings.jsx index 1da065400..e548d8ccd 100644 --- a/src/Editor/Modals/SettingsModal/ProjectSettings/ProjectSettings.jsx +++ b/src/Editor/Modals/SettingsModal/ProjectSettings/ProjectSettings.jsx @@ -67,6 +67,7 @@ class ProjectSettings extends Component { height: this.props.project.height, framerate: this.props.project.framerate, backgroundColor: this.props.project.backgroundColor.rgba, + imageSmoothing: this.props.project.imageSmoothing, preset: this.getPreset(this.props.project.width, this.props.project.height), } } @@ -137,6 +138,12 @@ class ProjectSettings extends Component { }); } + changeProjectImageSmoothing = () => { + this.setState({ + imageSmoothing: !this.state.imageSmoothing, + }); + } + acceptProjectSettings = () => { let newSettings = { name: this.state.name === '' ? this.defaultName : this.state.name, @@ -144,6 +151,7 @@ class ProjectSettings extends Component { height: this.state.height, backgroundColor: new window.Wick.Color(this.state.backgroundColor), framerate: this.state.framerate, + imageSmoothing: this.state.imageSmoothing, } this.props.updateProjectSettings(newSettings); @@ -157,6 +165,7 @@ class ProjectSettings extends Component { height: this.props.project.height, framerate: this.props.project.framerate, backgroundColor: this.props.project.backgroundColor.rgba, + imageSmoothing: this.props.project.imageSmoothing, preset: this.getPreset(this.props.project.width, this.props.project.height) }); } @@ -293,6 +302,21 @@ class ProjectSettings extends Component { ); } + renderImageSmoothingObject = () => { + return ( +