Skip to content

Commit

Permalink
ReferenceImagePanel renamed to ReferenceImageOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Dec 10, 2021
1 parent 09c6474 commit f4410f8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions example/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function create() {
referenceImageUrl(width, height) {
return width > height
? './refs/ref_landscape.jpg'
// : './refs/ref_portrait.jpg';
: null;
: './refs/ref_portrait.jpg';
},
}));

Expand Down
4 changes: 2 additions & 2 deletions src/core/reference-image.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReferenceImagePanel } from 'editor-view/actions/reference-image/reference-image.panel';
import { ReferenceImageOptions } from 'editor-view/actions/reference-image/reference-image.options';
import { PluginConfig, Size } from 'plugin.model';
import { ReferenceImage } from 'scene-view/reference-image/reference-image';
import { Preferences } from './preferences/preferences';
Expand Down Expand Up @@ -30,7 +30,7 @@ export class ReferenceImageController {
}

public openOptionsPanel(opener: HTMLElement) {
const p = (document.createElement(ReferenceImagePanel.tagName) as ReferenceImagePanel);
const p = (document.createElement(ReferenceImageOptions.tagName) as ReferenceImageOptions);
p.openPopup('Reference Image Options', opener, this.image);
p.addEventListener('closed', () => this.prefs.set('referenceImageFilters', this.image.getFilters()));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PopupContainer } from 'editor-view/popup/popup-container';
import { ReferenceImage, RefImageFilterTypes } from 'scene-view/reference-image/reference-image';
import './reference-image.panel.scss';
import './reference-image.options.scss';

export class ReferenceImagePanel extends PopupContainer {
export class ReferenceImageOptions extends PopupContainer {
public static readonly tagName = 'phred-reference-image-panel';

private image: ReferenceImage;
Expand Down Expand Up @@ -55,4 +55,4 @@ export class ReferenceImagePanel extends PopupContainer {
}
}

customElements.define(ReferenceImagePanel.tagName, ReferenceImagePanel);
customElements.define(ReferenceImageOptions.tagName, ReferenceImageOptions);
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ export class SizeTemplatesPanel extends HTMLElement {

public setResponsiveSizeTemplate(index: number, width: number, height: number) {
const prefs = Editor.prefs;

const currentSize = prefs.get('responsiveSize') as Size;

width = width ?? currentSize.width ?? Preferences.DefaultResponsiveSize.width;
height = height ?? currentSize.height ?? Preferences.DefaultResponsiveSize.height;

if (currentSize.height > currentSize.width) {
if (!width || !height) {
width = currentSize.width ?? Preferences.DefaultResponsiveSize.width;
height = currentSize.height ?? Preferences.DefaultResponsiveSize.height;
} else if (currentSize.height > currentSize.width) {
const aux = width;
width = height;
height = aux;
Expand Down

0 comments on commit f4410f8

Please sign in to comment.