discourse/app/assets/javascripts/wizard/addon/components/image-preview-large-icon.js
David Taylor 1506017767
DEV: Refactor wizard preview components to use inheritence (#20282)
The previous `createPreviewComponent` implementation was problematic for template colocation. We can achieve the same result using normal component class inheritance.
2023-02-14 14:20:15 +00:00

28 lines
595 B
JavaScript

import { observes } from "discourse-common/utils/decorators";
import WizardPreviewBaseComponent from "./wizard-preview-base";
export default WizardPreviewBaseComponent.extend({
width: 325,
height: 125,
ios: null,
image: null,
@observes("field.value")
imageChanged() {
this.reload();
},
images() {
return {
ios: "/images/wizard/apple-mask.png",
image: this.get("field.value"),
};
},
paint(options) {
const { width, height } = options;
this.scaleImage(this.image, 10, 8, 87, 87);
this.scaleImage(this.ios, 0, 0, width, height);
},
});