Skip to content

Commit cdd4b6f

Browse files
committed
Merge branch 'MC-4174-parallax-speed-value-does-not-work-as-documented' of github.com:magento-obsessive-owls/magento2-page-builder into cms-team-1-delivery
2 parents 7263884 + a4c2eb7 commit cdd4b6f

File tree

2 files changed

+12
-10
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+12
-10
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/row/preview.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/row/preview.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ContentTypeConfigInterface from "../../content-type-config.d";
1313
import ConditionalRemoveOption from "../../content-type-menu/conditional-remove-option";
1414
import {OptionsInterface} from "../../content-type-menu/option.d";
1515
import ContentTypeInterface from "../../content-type.d";
16+
import DataStore from "../../data-store";
1617
import ContentTypeMountEventParamsInterface from "../content-type-mount-event-params.d";
1718
import ContentTypeReadyEventParamsInterface from "../content-type-ready-event-params.d";
1819
import ObservableUpdater from "../observable-updater";
@@ -35,7 +36,8 @@ export default class Preview extends PreviewCollection {
3536
// Destroy all instances of the plugin prior
3637
try {
3738
// store/apply correct style after destroying, as jarallax incorrectly overrides it with stale value
38-
const style = this.element.getAttribute("style");
39+
const style = this.element.getAttribute("data-jarallax-original-styles") ||
40+
this.element.getAttribute("style");
3941
jarallax(this.element, "destroy");
4042
this.element.setAttribute("style", style);
4143
} catch (e) {
@@ -47,10 +49,10 @@ export default class Preview extends PreviewCollection {
4749
jarallax(
4850
this.element,
4951
{
50-
imgPosition: this.data.main.style().backgroundPosition || "50% 50%",
51-
imgRepeat: this.data.main.style().backgroundRepeat === "0" ? "no-repeat" : "repeat",
52-
imgSize: this.data.main.style().backgroundSize || "cover",
53-
speed: this.data.main.attributes()["data-parallax-speed"] || 0.5,
52+
imgPosition: this.parent.dataStore.get("background_position") as string || "50% 50%",
53+
imgRepeat: this.parent.dataStore.get("background_repeat") as "repeat" | "no-repeat",
54+
imgSize: this.parent.dataStore.get("background_size") as string || "cover",
55+
speed: Number.parseFloat(this.parent.dataStore.get("parallax_speed") as string) || 0.5,
5456
},
5557
);
5658
jarallax(this.element, "onResize");

0 commit comments

Comments
 (0)