注释
根据点击或悬浮事件得到选中行号,根据行号用[ngClass]绑定样式,若点击样式和悬浮样式同时起作用,把flag2=-1,去掉悬浮样式。
下面是unity自带的,在Scripts资源包里有拖拽代码,这个拖拽物体必须附加Rigidbody刚体组件。
DragRigidbodyjs
var spring = 500;
var damper = 50;
var drag = 100;
var angularDrag = 50;
var distance = 02;
var attachToCenterOfMass = false;
private var springJoint : SpringJoint;
function Update ()
{
// Make sure the user pressed the mouse down
if (!InputGetMouseButtonDown (0))
return;
var mainCamera = FindCamera();
// We need to actually hit an object
var hit : RaycastHit;
if (!PhysicsRaycast(mainCameraScreenPointToRay(InputmousePosition), hit, 100))
return;
// We need to hit a rigidbody that is not kinematic
if (!hitrigidbody || hitrigidbodyisKinematic)
return;
if (!springJoint)
{
var go = new GameObject("Rigidbody dragger");
var body : Rigidbody = goAddComponent ("Rigidbody") as Rigidbody;
springJoint = goAddComponent ("SpringJoint");
bodyisKinematic = true;
}
springJointtransformposition = hitpoint;
if (attachToCenterOfMass)
{
var anchor = transformTransformDirection(hitrigidbodycenterOfMass) + hitrigidbodytransformposition;
anchor = springJointtransformInverseTransformPoint(anchor);
springJointanchor = anchor;
}
else
{
springJointanchor = Vector3zero;
}
springJointspring = spring;
springJointdamper = damper;
springJointmaxDistance = distance;
springJointconnectedBody = hitrigidbody;
StartCoroutine ("DragObject", hitdistance);
}
function DragObject (distance : float)
{
var oldDrag = springJointconnectedBodydrag;
var oldAngularDrag = springJointconnectedBodyangularDrag;
springJointconnectedBodydrag = drag;
springJointconnectedBodyangularDrag = angularDrag;
var mainCamera = FindCamera();
while (InputGetMouseButton (0))
{
var ray = mainCameraScreenPointToRay (InputmousePosition);
springJointtransformposition = rayGetPoint(distance);
yield;
}
if (springJointconnectedBody)
{
springJointconnectedBodydrag = oldDrag;
springJointconnectedBodyangularDrag = oldAngularDrag;
springJointconnectedBody = null;
}
}
function FindCamera ()
{
if (camera)
return camera;
else
return Cameramain;
}
编程回忆录已经有八年的历史,是教程团队旗下的一个在线网络培训机构,目前已录制十三个科目,涉及到互联网开发,软件开发,游戏开发(虚拟现实开发),现在编程回忆录的Unity3D是国内唯一一家中文连载的大型视频教程。零基础开始讲解,通俗易懂 ,以实战为目地,受到众多网友的一致好评。
展示方式不同,所用技术不同。前端开发用到的技术包括但不限于html。css。javascript、jquery、Bootstrap、Nodejs、AngularJs等技术。后端开发以java为例主要用到的是包括但不限于StrutsspringspringmvcHibernate> 以上就是关于angular2 表格点击选中与鼠标悬浮全部的内容,包括:angular2 表格点击选中与鼠标悬浮、unity3d中判断鼠标是否在屏幕指定区域内、前端和后端开发有什么区别吗等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力! 欢迎分享,转载请注明来源:内存溢出
评论列表(0条)