Skip to content

Conversation

@lirencai
Copy link

当图片尚未加载完成时,确保下次能获取到正确的尺寸值。通过在检测到图片未就绪时将 _rect 设为 null,从而触发重新计算。

当图片尚未加载完成时,确保下次能获取到正确的尺寸值。通过在检测到图片未就绪时将 _rect 设为 null,从而触发重新计算。
Copy link
Member

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

具体的使用场景是什么样的?getBoundingRect 返回 null 可能是一种未定义的行为,请问哪里的逻辑保证了返回 null 会重新计算?可能更好的解决方案是,在外部使用的时候,判断图片是否完成了加载,而不是在内部做这个修改。

@Jancheng-z
Copy link

Jancheng-z commented Oct 9, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants