Skip to content

Commit

Permalink
Issue #470: remove references to tiled-preview, rename preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
juliandescottes committed Jun 4, 2016
1 parent 5533664 commit 4b8e5ac
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/js/controller/preview/PreviewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@

ns.PreviewController.prototype.updateZoom_ = function () {
var originalSizeEnabled = pskl.UserSettings.get(pskl.UserSettings.ORIGINAL_SIZE_PREVIEW);
var tiledPreviewEnabled = pskl.UserSettings.get(pskl.UserSettings.TILED_PREVIEW);
var useOriginalSize = originalSizeEnabled || tiledPreviewEnabled;
var seamlessModeEnabled = pskl.UserSettings.get(pskl.UserSettings.SEAMLESS_MODE);
var useOriginalSize = originalSizeEnabled || seamlessModeEnabled;

var zoom = useOriginalSize ? 1 : this.calculateZoom_();
this.renderer.setZoom(zoom);
Expand Down Expand Up @@ -208,12 +208,12 @@
};

ns.PreviewController.prototype.updateContainerDimensions_ = function () {
var isTiled = pskl.UserSettings.get(pskl.UserSettings.TILED_PREVIEW);
this.renderer.setRepeated(isTiled);
var isSeamless = pskl.UserSettings.get(pskl.UserSettings.SEAMLESS_MODE);
this.renderer.setRepeated(isSeamless);

var height, width;

if (isTiled) {
if (isSeamless) {
height = PREVIEW_SIZE;
width = PREVIEW_SIZE;
} else {
Expand Down
16 changes: 8 additions & 8 deletions src/js/controller/settings/ApplicationSettingsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@

this.addEventListener(gridSelect, 'change', this.onGridWidthChange_);

// Tiled preview
var tiledPreview = pskl.UserSettings.get(pskl.UserSettings.TILED_PREVIEW);
var tiledPreviewCheckbox = document.querySelector('.tiled-preview-checkbox');
if (tiledPreview) {
tiledPreviewCheckbox.setAttribute('checked', tiledPreview);
// Seamless mode
var seamlessMode = pskl.UserSettings.get(pskl.UserSettings.SEAMLESS_MODE);
var seamlessModeCheckbox = document.querySelector('.seamless-mode-checkbox');
if (seamlessMode) {
seamlessModeCheckbox.setAttribute('checked', seamlessMode);
}
this.addEventListener(tiledPreviewCheckbox, 'change', this.onTiledPreviewChange_);
this.addEventListener(seamlessModeCheckbox, 'change', this.onSeamlessModeChange_);

// Max FPS
var maxFpsInput = document.querySelector('.max-fps-input');
Expand All @@ -55,8 +55,8 @@
pskl.UserSettings.set(pskl.UserSettings.GRID_WIDTH, width);
};

ns.ApplicationSettingsController.prototype.onTiledPreviewChange_ = function (evt) {
pskl.UserSettings.set(pskl.UserSettings.TILED_PREVIEW, evt.currentTarget.checked);
ns.ApplicationSettingsController.prototype.onSeamlessModeChange_ = function (evt) {
pskl.UserSettings.set(pskl.UserSettings.SEAMLESS_MODE, evt.currentTarget.checked);
};

ns.ApplicationSettingsController.prototype.onBackgroundClick_ = function (evt) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/rendering/frame/CachedFrameRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
var serializedFrame = [
this.getZoom(),
this.getGridWidth(),
pskl.UserSettings.get('TILED_PREVIEW'),
pskl.UserSettings.get('SEAMLESS_MODE'),
offset.x, offset.y,
size.width, size.height,
frame.getHash()
Expand Down
6 changes: 3 additions & 3 deletions src/js/rendering/frame/FrameRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
this.margin.y - this.offset.y * z
);

if (pskl.UserSettings.get('TILED_PREVIEW')) {
if (pskl.UserSettings.get('SEAMLESS_MODE')) {
displayContext.clearRect(-1 * w * z, -1 * h * z, 3 * w * z, 3 * h * z);
} else {
displayContext.clearRect(0, 0, w * z, h * z);
Expand All @@ -268,14 +268,14 @@
if (gridWidth > 0) {
var scaled = pskl.utils.ImageResizer.resizeNearestNeighbour(this.canvas, z, gridWidth);

if (pskl.UserSettings.get('TILED_PREVIEW')) {
if (pskl.UserSettings.get('SEAMLESS_MODE')) {
this.drawTiledFrames_(displayContext, scaled, w, h, z);
}
displayContext.drawImage(scaled, 0, 0);
} else {
displayContext.scale(z, z);

if (pskl.UserSettings.get('TILED_PREVIEW')) {
if (pskl.UserSettings.get('SEAMLESS_MODE')) {
this.drawTiledFrames_(displayContext, this.canvas, w, h, 1);
}
displayContext.drawImage(this.canvas, 0, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/js/utils/UserSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
DEFAULT_SIZE : 'DEFAULT_SIZE',
CANVAS_BACKGROUND : 'CANVAS_BACKGROUND',
SELECTED_PALETTE : 'SELECTED_PALETTE',
TILED_PREVIEW : 'TILED_PREVIEW',
SEAMLESS_MODE : 'SEAMLESS_MODE',
ORIGINAL_SIZE_PREVIEW : 'ORIGINAL_SIZE_PREVIEW',
ONION_SKIN : 'ONION_SKIN',
LAYER_PREVIEW : 'LAYER_PREVIEW',
Expand All @@ -26,7 +26,7 @@
},
'CANVAS_BACKGROUND' : 'lowcont-dark-canvas-background',
'SELECTED_PALETTE' : Constants.CURRENT_COLORS_PALETTE_ID,
'TILED_PREVIEW' : false,
'SEAMLESS_MODE' : false,
'ORIGINAL_SIZE_PREVIEW' : false,
'ONION_SKIN' : false,
'LAYER_OPACITY' : 0.2,
Expand Down
6 changes: 3 additions & 3 deletions src/templates/settings/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
</div>

<div class="settings-item">
<label for="tiled-preview">Layer Opacity</label>
<label>Layer Opacity</label>
<input type="range" class="layer-opacity-input" name="layer-opacity" min="0" max="1" step="0.05"/>
<span class="layer-opacity-text"></span>
</div>

<div class="settings-item">
<label>
Seamless drawing mode
<input type="checkbox" value="1" class="tiled-preview-checkbox" name="tiled-preview-checkbox"/>
<input type="checkbox" value="1" class="seamless-mode-checkbox" name="seamless-mode-checkbox"/>
</label>
</div>

<div class="settings-item">
<label for="tiled-preview">Maximum FPS</label>
<label>Maximum FPS</label>
<input type="text" class="textfield textfield-small max-fps-input" autocomplete="off" name="max-fps"/>
</div>

Expand Down

0 comments on commit 4b8e5ac

Please sign in to comment.