Skip to content

Commit b7ffc72

Browse files
committed
use mat32.V2 instead of mat32.Vec2
1 parent 4016733 commit b7ffc72

9 files changed

+19
-19
lines changed

grid/align.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (gv *GridView) AlignMin(aa AlignAnchors, dim mat32.Dims, act string) {
6262
svoff := sv.WinBBox.Min
6363
sv.UndoSave(act, es.SelectedNamesString())
6464
abb, an := gv.AlignAnchorBBox(aa)
65-
sc := mat32.Vec2{1, 1}
65+
sc := mat32.V2(1, 1)
6666
odim := mat32.OtherDim(dim)
6767
for sn := range es.Selected {
6868
if sn == an {
@@ -87,7 +87,7 @@ func (gv *GridView) AlignMinAnchor(aa AlignAnchors, dim mat32.Dims, act string)
8787
svoff := sv.WinBBox.Min
8888
sv.UndoSave(act, es.SelectedNamesString())
8989
abb, an := gv.AlignAnchorBBox(aa)
90-
sc := mat32.Vec2{1, 1}
90+
sc := mat32.V2(1, 1)
9191
odim := mat32.OtherDim(dim)
9292
for sn := range es.Selected {
9393
if sn == an {
@@ -112,7 +112,7 @@ func (gv *GridView) AlignMax(aa AlignAnchors, dim mat32.Dims, act string) {
112112
svoff := sv.WinBBox.Min
113113
sv.UndoSave(act, es.SelectedNamesString())
114114
abb, an := gv.AlignAnchorBBox(aa)
115-
sc := mat32.Vec2{1, 1}
115+
sc := mat32.V2(1, 1)
116116
odim := mat32.OtherDim(dim)
117117
for sn := range es.Selected {
118118
if sn == an {
@@ -137,7 +137,7 @@ func (gv *GridView) AlignMaxAnchor(aa AlignAnchors, dim mat32.Dims, act string)
137137
svoff := sv.WinBBox.Min
138138
sv.UndoSave(act, es.SelectedNamesString())
139139
abb, an := gv.AlignAnchorBBox(aa)
140-
sc := mat32.Vec2{1, 1}
140+
sc := mat32.V2(1, 1)
141141
odim := mat32.OtherDim(dim)
142142
for sn := range es.Selected {
143143
if sn == an {
@@ -163,7 +163,7 @@ func (gv *GridView) AlignCenter(aa AlignAnchors, dim mat32.Dims, act string) {
163163
sv.UndoSave(act, es.SelectedNamesString())
164164
abb, an := gv.AlignAnchorBBox(aa)
165165
ctr := mat32.NewVec2FmPoint(abb.Min.Add(abb.Max)).MulScalar(0.5)
166-
sc := mat32.Vec2{1, 1}
166+
sc := mat32.V2(1, 1)
167167
odim := mat32.OtherDim(dim)
168168
for sn := range es.Selected {
169169
if sn == an {

grid/bbox.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ func (ev BBoxPoints) PointRect(bb image.Rectangle) mat32.Vec2 {
131131
val := ev.ValRect(bb)
132132
switch ev {
133133
case BBLeft, BBCenter, BBRight:
134-
return mat32.Vec2{val, 0.5 * float32(bb.Min.Y+bb.Max.Y)}
134+
return mat32.V2(val, 0.5*float32(bb.Min.Y+bb.Max.Y))
135135
default:
136-
return mat32.Vec2{0.5 * float32(bb.Min.X+bb.Max.X), val}
136+
return mat32.V2(0.5*float32(bb.Min.X+bb.Max.X), val)
137137
}
138138
}
139139

@@ -144,9 +144,9 @@ func (ev BBoxPoints) PointBox(bb mat32.Box2) mat32.Vec2 {
144144
val := ev.ValBox(bb)
145145
switch ev {
146146
case BBLeft, BBCenter, BBRight:
147-
return mat32.Vec2{val, 0.5 * (bb.Min.Y + bb.Max.Y)}
147+
return mat32.V2(val, 0.5*(bb.Min.Y+bb.Max.Y))
148148
default:
149-
return mat32.Vec2{0.5 * (bb.Min.X + bb.Max.X), val}
149+
return mat32.V2(0.5*(bb.Min.X+bb.Max.X), val)
150150
}
151151
}
152152

grid/dashes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func DashIconsInit() {
196196
ic := &svg.Icon{}
197197
ic.InitName(ic, k)
198198
ic.SetProp("width", units.NewCh(20))
199-
ic.ViewBox.Size = mat32.Vec2{1, 1}
199+
ic.ViewBox.Size = mat32.V2(1, 1)
200200
p := svg.AddNewPath(ic, "p", "M 0.05 0.5 .95 0.5 Z")
201201
p.SetProp("stroke-width", units.NewPct(2))
202202
p.SetProp("stroke-dasharray", DashString(DashMulWidth(.05, v)))

grid/edits.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ func (gr *Gradient) UpdateIcon() {
558558
if err != nil {
559559
ic = &svg.Icon{}
560560
ic.InitName(ic, nm)
561-
ic.ViewBox.Size = mat32.Vec2{1, 1}
561+
ic.ViewBox.Size = mat32.V2(1, 1)
562562
ic.SetProp("width", units.NewCh(5))
563563
svg.CurIconSet[nm] = ic
564564
} else {

grid/manip.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func (sv *SVGView) DragMove(win *gi.Window, me *mouse.DragEvent) {
338338
tdel := es.DragSelEffBBox.Min.Sub(es.DragSelStartBBox.Min)
339339
for itm, ss := range es.Selected {
340340
itm.ReadGeom(ss.InitGeom)
341-
itm.ApplyDeltaTransform(tdel, mat32.Vec2{1, 1}, 0, pt)
341+
itm.ApplyDeltaTransform(tdel, mat32.V2(1, 1), 0, pt)
342342
}
343343
sv.SetBBoxSpritePos(SpReshapeBBox, 0, es.DragSelEffBBox)
344344
sv.SetSelSpritePos()
@@ -531,7 +531,7 @@ func (sv *SVGView) SpriteRotateDrag(sp Sprites, delta image.Point, win *gi.Windo
531531
svoff := mat32.NewVec2FmPoint(sv.WinBBox.Min)
532532
pt = pt.Sub(svoff)
533533
del := mat32.Vec2{}
534-
sc := mat32.Vec2{1, 1}
534+
sc := mat32.V2(1, 1)
535535
for itm, ss := range es.Selected {
536536
itm.ReadGeom(ss.InitGeom)
537537
itm.ApplyDeltaTransform(del, sc, ang, pt)

grid/markers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func MarkerIconsInit() {
317317
ic.InitName(ic, "marker-"+k) // keep it distinct with marker- prefix
318318
ic.SetProp("width", units.NewCh(6))
319319
ic.SetProp("height", units.NewEm(2))
320-
ic.ViewBox.Size = mat32.Vec2{1, 1}
320+
ic.ViewBox.Size = mat32.V2(1, 1)
321321
var p *svg.Path
322322
lk := strings.ToLower(k)
323323
start := true

grid/path.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ func (sv *SVGView) PathNodeSetOnePoint(path *svg.Path, pts []*PathNode, pidx int
262262
pn := pts[i]
263263
wbmin := mat32.NewVec2FmPoint(path.WinBBox.Min)
264264
pt := wbmin.Sub(svoff)
265-
xf, lpt := path.DeltaTransform(dv, mat32.Vec2{1, 1}, 0, pt, true) // include self
266-
npt := xf.MulVec2AsPtCtr(pn.Cp, lpt) // transform point to new abs coords
265+
xf, lpt := path.DeltaTransform(dv, mat32.V2(1, 1), 0, pt, true) // include self
266+
npt := xf.MulVec2AsPtCtr(pn.Cp, lpt) // transform point to new abs coords
267267
sv.PathNodeSetPoint(path, pn, npt)
268268
if i == pidx {
269269
dv = dv.MulScalar(-1)

grid/select.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ func (gv *GridView) SelRotate(deg float32) {
429429

430430
svoff := sv.WinBBox.Min
431431
del := mat32.Vec2{}
432-
sc := mat32.Vec2{1, 1}
432+
sc := mat32.V2(1, 1)
433433
rot := mat32.DegToRad(deg)
434434
for sn := range es.Selected {
435435
sng := sn.AsSVGNode()
@@ -452,7 +452,7 @@ func (gv *GridView) SelScale(scx, scy float32) {
452452

453453
svoff := sv.WinBBox.Min
454454
del := mat32.Vec2{}
455-
sc := mat32.Vec2{scx, scy}
455+
sc := mat32.V2(scx, scy)
456456
for sn := range es.Selected {
457457
sng := sn.AsSVGNode()
458458
sz := mat32.NewVec2FmPoint(sng.WinBBox.Size())

grid/svgview.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ func (sv *SVGView) ResizeToContents(grid_off bool) {
515515

516516
bsz = bsz.DivScalar(sv.Scale)
517517

518-
sv.TransformAllLeaves(treff, mat32.Vec2{1, 1}, 0, mat32.Vec2{0, 0})
518+
sv.TransformAllLeaves(treff, mat32.V2(1, 1), 0, mat32.V2(0, 0))
519519
sv.ViewBox.Size = bsz
520520
sv.PhysWidth.Val = bsz.X
521521
sv.PhysHeight.Val = bsz.Y

0 commit comments

Comments
 (0)