Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: 设置背景图片后,从新修改背景,删除背景图片,不生效背景还存在。 #1995

Closed
PandaX-Go opened this issue Dec 6, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@PandaX-Go
Copy link

发生了什么?

设置背景图片 生效
background = {
backgroundColor: "#ffffff",
backgroundImage: "url(img/bg-h/bg-h1.jpg)",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
}
取消背景图片
background = {
backgroundColor: "#ffffff",
}
画布上上一次设置的图片还在,无法消除
image

logicflow/core版本

2.0.9

logicflow/extension版本

2.0.13

logicflow/engine版本

No response

浏览器&环境

Chrome

@PandaX-Go PandaX-Go added the bug Something isn't working label Dec 6, 2024
@DymoneLewis
Copy link
Collaborator

那更新背景是怎么更新的呢,用的updateBackgroundOptions方法吗还是别的?

@PandaX-Go
Copy link
Author

PandaX-Go commented Dec 10, 2024 via email

@DymoneLewis
Copy link
Collaborator

使用的updateBackgroundOptions方法

---- 回复的原邮件 ---- | 发件人 | @.> | | 日期 | 2024年12月10日 21:07 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [didi/LogicFlow] [Bug Report]: 设置背景图片后,从新修改背景,删除背景图片,不生效背景还存在。 (Issue #1995) | 那更新背景是怎么更新的呢,用的updateBackgroundOptions方法吗还是别的? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

了解,我看下

@ChangeSuger
Copy link
Collaborator

/**
* 更新网格配置
*/
updateBackgroundOptions(
options: boolean | Partial<LFOptions.BackgroundConfig>,
) {
if (isBoolean(options) || isBoolean(this.background)) {
this.background = options
} else {
this.background = {
...this.background,
...options,
}
}
}

updateBackgroundOptions() 方法是增量更新背景选项的,可以试一下以下方式来实现清除背景:

// 设置背景图片 生效
background = {
  backgroundColor: "#ffffff",
  backgroundImage: "url(img/bg-h/bg-h1.jpg)",
  backgroundRepeat: "no-repeat",
  backgroundSize: "cover",
}

// 取消背景图片
background = {
  backgroundImage: "",
}

@PandaX-Go
Copy link
Author

可以的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants