home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar Special 2002 April
/
GSSH42002.iso
/
EDITOREN
/
DS
/
gmax
/
gmaxinst_1-1.exe
/
gmaxsetup11.cab
/
gMaterialEDtabs.swf
/
scripts
/
frame_2
/
DoAction.as
Wrap
Text File
|
2002-02-13
|
4KB
|
146 lines
function hitTab()
{
var dx = drag.x + this._xmouse - drag.icon._x;
var dy = drag.y + this._ymouse - drag.icon._y;
if(distanceDrop < dx * dx + dy * dy)
{
return null;
}
vDrop[0].x = drag.icon._x + Math.floor((drag.icon._width - widthDrop) / 2);
vDrop[0].y = drag.icon._y + Math.floor((drag.icon._height - heightDrop) / 2);
vDrop[1].x = vDrop[0].x;
vDrop[1].y = drag.icon._y + Math.ceil((drag.icon._height + heightDrop) / 2);
vDrop[2].x = drag.icon._x + Math.ceil((drag.icon._width + widthDrop) / 2);
vDrop[2].y = vDrop[1].y;
vDrop[3].x = vDrop[2].x;
vDrop[3].y = vDrop[0].y;
var tab;
var i;
var j;
i = 0;
while(i < tabs.list.length)
{
tab = tabs.list[i];
if(!tab.targetNull)
{
j = 0;
while(j < 4 and tab.hitTest(vDrop[j].x,vDrop[j].y,true))
{
j++;
}
if(j == 4)
{
if(tab == drag.tab)
{
return null;
}
if(drag.icon.type == "color" and !tab.targetColor)
{
return null;
}
if(tab == tabs.ambient and tabs.lockAmbient._visible)
{
return null;
}
if(tab == tabs.specularColor and tabs.lockSpecular._visible)
{
return null;
}
return tab;
}
}
i++;
}
return null;
}
function dragIcon(icon)
{
var tab = icon._parent;
if(!drag.enabled or drag.tab != null or tab == this)
{
return undefined;
}
if(icon.type == "color")
{
tab = tab._parent;
}
if(tabs.current != tab)
{
tabs.select(tab);
}
drag.tab = tab;
var src;
if(icon.type == "color")
{
drag.icon = dragColor;
src = tab.value;
new Color(dragColor.value).setRGB(new Color(src.color.value).getRGB());
}
else
{
if(icon.type != "map")
{
return undefined;
}
drag.icon = dragMap;
src = tab.map;
}
drag.x = tab._x + src._x - this._xmouse;
drag.y = tab._y + src._y - this._ymouse;
drag.icon._x = drag.x + this._xmouse;
drag.icon._y = drag.y + this._ymouse;
drag.icon._visible = true;
getURL("FSCommand:copy",icon.type + "," + target.label.text);
}
function moveIcon()
{
if(!drag.enabled or drag.tab == null)
{
return undefined;
}
var x = drag.x + this._xmouse;
var y = drag.y + this._ymouse;
x = Math.max(x,0);
y = Math.max(y,0);
x = Math.min(x,this._width - drag.icon._width - 1);
y = Math.min(y,tabs._height - drag.icon._height - 1);
drag.icon._x = x;
drag.icon._y = y;
var target = hitTab();
if(target == null or target == drag.tab)
{
dragTarget._visible = false;
}
else
{
var icon;
if(drag.icon.type == "map")
{
icon = target.map;
}
else
{
icon = target.value;
}
dragTarget._x = target._x + icon._x + 0.5;
dragTarget._y = target._y + icon._y + 0.2;
dragTarget._visible = true;
}
}
function dropIcon(icon)
{
var source = drag.tab;
drag.tab = null;
drag.icon._visible = false;
dragTarget._visible = false;
if(!drag.enabled)
{
return undefined;
}
var target = hitTab();
if(target != null and target != source)
{
getURL("FSCommand:" add icon.type,source.label.text + "," + target.label.text);
}
}