Why changing canvas size resets its parameters?

后端 未结 1 1451
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-27 23:34

When I change the canvas size, I notice the parameter \'mozImageSmoothingEnabled\' is being reset.

HTML

Your browser don\'t         


        
相关标签:
1条回答
  • 2020-11-28 00:21

    Because when you change the canvas width or height parameters, every properties of the attached context are reset to their default.

    From specs

    When the canvas element is created, and subsequently whenever the width and height attributes are set (whether to a new value or to the previous value), the bitmap and any associated contexts must be cleared back to their initial state and reinitialized with the newly specified coordinate space dimensions.

    0 讨论(0)
提交回复
热议问题