Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: add widget to default location
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Sep 26, 2021
1 parent d236bed commit eb1db48
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions internal/usecase/interactor/scene.go
Expand Up @@ -218,12 +218,22 @@ func (i *Scene) AddWidget(ctx context.Context, sid id.SceneID, pid id.PluginID,

s.WidgetSystem().Add(widget)

if !floating && location != nil {
s.WidgetAlignSystem().Area(scene.WidgetLocation{
Zone: scene.WidgetZoneType(location.Zone),
Section: scene.WidgetSectionType(location.Section),
Area: scene.WidgetAreaType(location.Area),
}).Add(widget.ID(), -1)
if !floating {
var loc scene.WidgetLocation
if location != nil {
loc = scene.WidgetLocation{
Zone: scene.WidgetZoneType(location.Zone),
Section: scene.WidgetSectionType(location.Section),
Area: scene.WidgetAreaType(location.Area),
}
} else {
loc = scene.WidgetLocation{
Zone: scene.WidgetZoneInner,
Section: scene.WidgetSectionLeft,
Area: scene.WidgetAreaTop,
}
}
s.WidgetAlignSystem().Area(loc).Add(widget.ID(), -1)
}

err = i.propertyRepo.Save(ctx, property)
Expand Down

0 comments on commit eb1db48

Please sign in to comment.