Exemplo n.º 1
0
func (self *pane) pix2Vec(evnt *js.Object) mgl32.Vec2 {
	v := mgl32.Vec3{ // generate vector from current pixel coords
		float32(evnt.Get("clientX").Float()),
		float32(evnt.Get("clientY").Float()),
		1.0, // apply translations from transform matrix
	}
	v = self.untransform.Mul3x1(v) // apply pan & zoom untransform matrix

	return v.Vec2() // return vec2
}
Exemplo n.º 2
0
func (w *Window) SetTranslation(translation mgl32.Vec3) {
	w.node.SetTranslation(translation)
	w.position = translation.Vec2()
}
Exemplo n.º 3
0
func (w *Window) SetScale(scale mgl32.Vec3) {
	w.background.SetScale(scale)
	w.size = scale.Vec2()
	w.Render()
}