| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //go:build js && wasm
- package ultraviolet
- import (
- "syscall/js"
- )
- type ImageComponentWeb struct {
- node js.Value
- view View
- change bool
- path string
- width int
- }
- func NewImageComponentWeb(view View) *ImageComponentWeb {
- return &ImageComponentWeb{
- view: view,
- change: true,
- path: "",
- }
- }
- // Component
- func (this *ImageComponentWeb) Build(parent Component) {
- this.node = WebBuildImg(
- this.node,
- parent,
- this.view,
- this.path,
- this.width,
- )
- }
- func (this *ImageComponentWeb) Invalidate() bool {
- result := this.change
- this.change = false
- return result
- }
- func (this *ImageComponentWeb) Clean() {
- WebCleanChildren(this.node)
- }
- // JS
- func (this *ImageComponentWeb) Node() js.Value {
- return this.node
- }
- // ComponentImage
- func (this *ImageComponentWeb) SetPath(path string) {
- this.path = path
- }
- func (this *ImageComponentWeb) SetWidth(width int) {
- this.width = width
- }
|