new collie.Text(htOption)
Text - ๋ง์ค์์ Canvas์ผ ๋๋ง ๋๋ค. DOM์ ๋ฏธ๊ตฌํ
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
htOption |
Object |
optional
|
- TODO
-
- Text๋ ๋ง์ค์๊ณผ ์๋ ์ค๋ฐ๊ฟ ๋๋ฌธ์ ๋ชจ๋ฐ์ผ์์ ์ฌ์ฉํ๋ฉด ๊ต์ฅํ ๋๋ฆฌ๋ค. WebWorker๋ฅผ ์ธ ์ ์๋์ง ํ์ธํด ๋ด์ผ ํ ๊ฒ
Example
๊ธฐ๋ณธ์ ์ธ ์ฌ์ฉ๋ฒ
var oText = new collie.Text({
width : 100, // ๋๋น์ ๋์ด๋ฅผ ๋ฐ๋์ ์ง์ ํด์ผ ํฉ๋๋ค.
height : 100,
x : 0,
y : 0,
fontColor : "#000000"
}).text("ํ
์คํธ ์
๋๋ค");
Extends
Members
-
typeString
-
ํด๋์ค ํ์
Methods
-
inherited addChild(oDisplayObject)
-
DisplayObject์ ์์์ ์ถ๊ฐ ํ๋ค - ์์์ผ๋ก ๋ค์ด๊ฐ DisplayObject๋ ํ์ฌ DisplayObject์ zIndex ์ํฅ์ ๋ฐ๊ฒ ๋๋ค
Name Type Description oDisplayObject
collie.DisplayObject -
inherited addMatrix(vMatrix)
-
๋ค์ํ ์์ฑ์ ๋ณ๊ฒฝํ๋ฉฐ ์ฌ์ฉํ ๊ฒฝ์ฐ addMatrix๋ฅผ ์ด์ฉํด ์ค์ ์ ๋ฏธ๋ฆฌ ๋ง๋ค๊ณ changeMatrix๋ก ๋ณ๊ฒฝํด ์ฌ์ฉํ ์ ์๋ค.
Name Type Description vMatrix
Array | Object ๋ฐฐ์ด๋ก ์ฌ๋ฌ๊ฐ๋ฅผ ํ๋ฒ์ ๋ฃ์ ์ ์์
Name Type Description name
String Matrix ์ด๋ฆ
property
Number ๋ณ๊ฒฝํ ์ค์ ์ ์ ๋ ฅํ๋ค
Example
oDisplayObject.addMatrix({ name : "test" offsetX : 0, offsetY : 100 }); oDisplayObject.addMatrix([ { name : "test2", offsetX : 100, offsetY : 100, width : 50, height : 50 }, { name : "test3", offsetX : 200, offsetY : 100, width : 80, height : 80 } ]);
oDisplayObject.changeMatrix("test2"); oDisplayObject.changeMatrix("test3");
-
inherited addTo(oTarget){collie.DisplayObject}
-
๋ ์ด์ด๋ DisplayObject ๊ฐ์ฒด์ ํ์ฌ ๊ฐ์ฒด๋ฅผ ์ถ๊ฐ ํ๋ค.
Name Type Description oTarget
collie.Layer | collie.DisplayObject -
inherited align(sHorizontal, sVertical, oBaseObject)
-
๊ฐ์ฒด์ ์์น๋ฅผ ์ ๋ ฌํ๋ค.
Name Type Default Description sHorizontal
String | Boolean center optional ์ํ ์ ๋ ฌ [left|right|center], false๋ฉด ์ ๋ ฌํ์ง ์์
sVertical
String | Boolean center optional ์์ง ์ ๋ ฌ [top|bottom|center], false๋ฉด ์ ๋ ฌํ์ง ์์
oBaseObject
collie.DisplayObject optional ๊ธฐ์ค ๊ฐ์ฒด, ๊ฐ์ด ์์ ๊ฒฝ์ฐ ๋ถ๋ชจ, ๋ถ๋ชจ๊ฐ ์์ ๊ฒฝ์ฐ ๋ ์ด์ด๋ฅผ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ ํ๋ค.
-
inherited attach(vEvent, fHandler){collie.Component}
-
์ด๋ฒคํธ ํธ๋ค๋ฌ ์ถ๊ฐ
Name Type Description vEvent
Object | String fHandler
Function Returns:
์ฒด์ด๋ ์ง์
-
inherited bottom(nPosition){collie.DisplayObject}
-
๊ฐ์ฒด์ ์์น๋ฅผ ํ๋จ ๊ธฐ์ค์ผ๋ก ์ขํ๋งํผ ์ด๋ํ๋ค ๋ง์ผ Layer์ ๋ถ์ ์ํ๊ฐ ์๋๋ผ๋ฉด ๋ถ์ ํ์ ์ด๋ํ ์ ์๋๋ก ํด ์ค๋ค
Name Type Description nPosition
Number ํ๋จ ๊ธฐ์ค x์ขํ
Returns:
์์ ์ ๋ฐํ
-
inherited changeMatrix(sName)
-
ํด๋น Matrix๋ก ๋ณ๊ฒฝํ๋ค
Name Type Description sName
String ๋งคํธ๋ฆญ์ค ์ด๋ฆ
-
inherited clone(bRecursive){collie.DisplayObject}
-
๊ฐ์ฒด ๋ณต์ฌ ์ด๋ฒคํธ๋ ๋ณต์ฌ๋์ง ์๋๋ค.
Name Type Description bRecursive
Boolean ์์๊น์ง ๋ชจ๋ ๋ณต์ฌํ๋์ง ์ฌ๋ถ
Example
var box = new collie.DisplayObject({ width: 100, height: 100, backgroundColor: "blue" }).addTo(layer);
var box2 = box.clone().addTo(layer);
-
inherited detach(vEvent, fHandler)
-
์ด๋ฒคํธ ํธ๋ค๋ฌ๋ฅผ ํด์ ํ๋ค
Name Type Description vEvent
Object | String fHandler
Function ๊ฐ์ด ์์ ๊ฒฝ์ฐ ์ด ์ด๋ฒคํธ์ ํ ๋น๋ ์ ์ฒด ํธ๋ค๋ฌ๋ฅผ ํด์ ํ๋ค
-
inherited detachAll(sName)
-
๋ชจ๋ ์ด๋ฒคํธ ํธ๋ค๋ฌ๋ฅผ ํด์
Name Type Description sName
String ์ด๋ฒคํธ ์ด๋ฆ, ๊ฐ์ด ์์ผ๋ฉด ์ด ์ปดํฌ๋ํธ์ ํ ๋น๋ ๋ชจ๋ ์ด๋ฒคํธ๋ฅผ ํด์ ํ๋ค
-
inherited fireEvent(sName, oEvent){Boolean}
-
์ด๋ฒคํธ ๋ฐ์
Name Type Description sName
String oEvent
Object Returns:
๋ฐ์ ์ค collie.ComponentEvent์ stop ๋ฉ์๋๊ฐ ์คํ๋ ๊ฒฝ์ฐ false๋ฅผ ๋ฐํํ๋ค
-
inherited get(sKey){Variable|Object}
-
์ค์ ๊ฐ์ ๊ฐ์ ธ์จ๋ค
Name Type Description sKey
String ๊ฐ์ด ์์ผ๋ฉด ์ ์ฒด ๊ฐ์ ๋ฐํ
Returns:
๊ฐ
Examples
var htData = oDisplayObject.get(); var bVisible = oDisplayObject.get("visible");
<caption>์ฑ๋ฅ์ ์ฌ๋ฆฌ๊ธฐ ์ํด์๋ ๋ฉ์๋ ํธ์ถ์ ์ต์ํ์ผ๋ก ์ค์ด๋ ๊ฒ์ด ์ข๋ค If you want to improve performance to your service, you should use less method call.</caption> // before var x = oDisplayObject.get("x"); var y = oDisplayObject.get("y"); var width = oDisplayObject.get("width"); var height = oDisplayObject.get("height");
// after var htInfo = oDisplayObject.get(); htInfo.x; htInfo.y; htInfo.width; htInfo.height;
// or you can access a htOption object directly. It's not recommend but It's better than frequently method call. oDisplayObject._htOption.x; oDisplayObject._htOption.y; oDisplayObject._htOption.width; oDisplayObject._htOption.height;
-
inherited getBoundary(bWithRelatedPosition, bWithPoints){Object}
-
ํ์ฌ ํ์ ๊ฐ์ฒด์ ์ฌ๊ฐํ ์์ญ์ ๋ฐํ ํ๋ค - transform๋ ์์ญ์ ๋ฐํ TODO Transform Matrix์ origin์ ์๋์ขํ๋ฅผ ์ ์ฉํด์ผ ํ๊ธฐ ๋๋ฌธ์ ์บ์๋ฅผ ์ ์ฉํ ์ ์์ TODO Transform ์ ๋์ง๋ ๋ถ๋ชจ๋ฅผ ํ๊ณ ๊ฐ๋ด์ผ ์ ์ ์์!
Name Type Description bWithRelatedPosition
Boolean ์ ๋์ขํ๋ก ๋ณ๊ฒฝํด์ ๋ฐํํ๋์ง ์ฌ๋ถ
bWithPoints
Boolean ์ขํ๋ฅผ ๋ฐํํ๋์ง ์ฌ๋ถ, Sensor์ box hittest์์ ์ฐ์
Returns:
Name Type Description oBoundary
Object Name Type Description oBoundary.left
Number oBoundary.right
Number oBoundary.top
Number oBoundary.bottom
Number isTransform
Number ํธ๋์คํผ ์ฌ์ฉ ์ฌ๋ถ points
Array bWithPoints๋ฅผ true๋ก ํ๋ฉด ์ขํ ๋ฐฐ์ด์ด ๋์ด์ด, [[x, y], [x, y], ...] -
inherited getChildren(){Array}
-
์์์ ๋ฐํ
-
inherited getDirty(sKey){Boolean}
-
๊ฐ์ด ๋ณ๊ฒฝ๋ ๊ฒ์ ์๋ฆผ
Name Type Description sKey
String ํค ์ด๋ฆ
Returns:
๊ฐ์ด ๋ณ๊ฒฝ ๋์
-
inherited getDrawing(){collie.DisplayObjectCanvas|collie.DisplayObjectDOM}
-
๋๋ก์ ๊ฐ์ฒด๋ฅผ ๋ฐํ
-
inherited getHitAreaBoundary(){Object}
-
์ด๋ฒคํธ์ ๊ด๋ จ๋ ์์ญ์ ๋ฐํ ํ๋ค - transform๋ ์์ญ์ ๋ฐํ - ์ ๋ ์ขํ๋ก ๋ณํํด์ ๋ฐํํ๋ค
Returns:
Name Type Description htReturn
Object Name Type Description left
Number minX right
Number maxX top
Number minY bottom
Number maxY -
inherited getId(){String}
-
์์ด๋๋ฅผ ๋ฐํ ํ๋ค
-
inherited getImage(){HTMLElement}
-
ํ์ฌ ๊ฐ์ฒด์ ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์จ๋ค
-
inherited getImageSize(){Boolean|Object}
-
์ด๋ฏธ์ง ํฌ๊ธฐ๋ฅผ ๋ฐํ, ๋ ํฐ๋์ผ ๊ฒฝ์ฐ ๋ณด์ ๋ ๊ฐ์ ๋ฐํ ํ๋ค Return a size of the image set to backgroundImage property. If The User has a retina display, this method would return a half of size. ex) 640940 -> 320480
Returns:
Name Type Description htSize
Boolean | Object ์ด๋ฏธ์ง๊ฐ ๋ก๋๋์ง ์์์ผ๋ฉด false๋ฅผ ๋ฐํ. It would return as false when it has not loaded the image yet. Name Type Description htSize.width
Number htSize.height
Number -
inherited getLayer(){collie.Layer|Boolean}
-
๋ ์ด์ด ๋ฐํ
-
inherited getParent(){collie.DisplayObject}
-
๋ถ๋ชจ๋ฅผ ๋ฐํ
-
inherited getRelatedPosition(){Object}
-
๋ถ๋ชจ์ ์ฐ๊ด๋ ์ ์ฒด ์ขํ๋ฅผ ๊ตฌํ๋ค(์ ๋์ขํ)
- TODO
-
- ๋ฉ์๋ ๋ช ์ด ์ง๊ด์ ์ด์ง ๋ชปํ๋ค
Returns:
Name Type Description htPos
Object Name Type Description htPos.x
Number htPos.y
Number -
getTextWidth(fCallback){Number}
-
ํ ์คํธ ์ต๋ ๋๋น๋ฅผ ๋ฐํ, ๊ทธ๋ ค์ง๊ธฐ ์ ์๋ ๋ฐํ์ด ๋์ง ์๊ธฐ ๋๋ฌธ์ callback ํจ์๋ฅผ ๋ฃ์ด ๊ทธ๋ ค์ง ํ์ ๊ฐ์ ๋ฐ์์ฌ ์ ์๋ค ์ฝ๋ฐฑ ํจ์ ์ฒซ๋ฒ์งธ ์ธ์๊ฐ ๋๋น ๊ฐ
Name Type Description fCallback
Function Returns:
์ต๋ ๋๋น
-
inherited hasAttachedHandler(){Boolean}
-
attach๋ ์ด๋ฒคํธ ํธ๋ค๋ฌ๊ฐ ์๋์ง ์ฌ๋ถ๋ฅผ ๋ฐํ
-
inherited hasChild(){Boolean}
-
์์์ด ์๋์ง ๋ฐํ
Returns:
์๋ค๋ฉด true
-
inherited isChanged(bChangedOnlyTranforms){Boolean}
-
ํ์ฌ ๊ฐ์ฒด์ ๋ณ๊ฒฝ๋ ๋ด์ฉ ์ฌ๋ถ๋ฅผ ๋ฐํ DOM์ผ ๊ฒฝ์ฐ ๋ณ๊ฒฝ๋๊ฒ ์์ผ๋ฉด ๋ค์ ์๊ทธ๋ฆผ
Name Type Description bChangedOnlyTranforms
Boolean -
๋ถ๋ชจ๊ฐ ์์ ๊ฒฝ์ฐ ๋ถ๋ชจ์์ ์์ ์ ๋บ๋ค
Returns:
๋ฐํ
-
inherited move(nX, nY, nVelocity, fCallback){collie.AnimationTransition}
-
ํน์ ์๋๋ก ํด๋น ์ง์ ๊น์ง ์ด๋
Name Type Description nX
Number ๊ฐ๊ณ ์ ํ๋ ๊ณณ์ x ์ขํ
nY
Number ๊ฐ๊ณ ์ ํ๋ ๊ณณ์ y ์ขํ
nVelocity
Number ์ด๋น ์ด๋ ๊ฑฐ๋ฆฌ(px), ์๋๊ฐ 0 ์ด๋ฉด ๋ฐ๋ก ์ด๋ํ๋ค.
fCallback
Function ์ด๋์ด ๋๋ ํ ์คํ๋ ์ฝ๋ฐฑ
Name Type Description displayobject
collie.DisplayObject ํ์ฌ ๊ฐ์ฒด๊ฐ ์ธ์๋ก ๋์ด๊ฐ=
Returns:
์ฌ์ฉ๋๋ ํ์ด๋จธ๋ฅผ ๋ฐํ
-
inherited moveBy(nX, nY, nVelocity, fCallback){collie.AnimationTransition}
-
์๋ ๊ฒฝ๋ก๋ก ์ด๋
Name Type Description nX
Number ๊ฐ๊ณ ์ ํ๋ ๊ณณ์ x ์ขํ
nY
Number ๊ฐ๊ณ ์ ํ๋ ๊ณณ์ y ์ขํ
nVelocity
Number ์ด๋น ์ด๋ ๊ฑฐ๋ฆฌ(px), ์๋๊ฐ 0 ์ด๋ฉด ๋ฐ๋ก ์ด๋ํ๋ค.
fCallback
Function ์ด๋์ด ๋๋ ํ ์คํ๋ ์ฝ๋ฐฑ
Returns:
์ฌ์ฉ๋๋ ํ์ด๋จธ๋ฅผ ๋ฐํ
-
inherited option(vName, vValue, bNotOverwrite)
-
์ปดํฌ๋ํธ์ ์ต์ ์ ์ค์ ํ๋ค.
Name Type Description vName
Object | String ์ต์ ์ด๋ฆ์ด๋ ์ฌ๋ฌ ์ต์ ์ ์ค์ ํ ์ ์๋ ๊ฐ์ฒด๋ฅผ ๋ฃ์ ์ ์๋ค.
vValue
Variables optional ์ต์ ๊ฐ, ๊ฐ์ด ์๋ค๋ฉด ํด๋น ์ต์ ๊ฐ์ ๋ฐํํ๋ค.
bNotOverwrite
Boolean optional ์ด ๊ฐ์ด true๋ฉด ๊ธฐ์กด์ ๊ฐ์ด ์์ ๊ฒฝ์ฐ ๋ฎ์ด ์์ฐ์ง ์๋๋ค
Example
component.option({ a : 1, b : true });
component.option("a", 1); component.option("a"); // return 1
-
inherited optionSetter(sName, fSetter)
-
์ต์ ๊ฐ์ด ์ค์ ๋ ๋ ์คํ๋ ํจ์๋ฅผ ์ง์ ํ๋ค. Setter๋ ํ ์์ฑ ๋น ํ ๊ฐ์ ํจ์๋ง ์ค์ ํ ์ ์๋ค.
Name Type Description sName
String fSetter
Function -
inherited removeChild(oDisplayObject, nIdx)
-
์์์ ์ ๊ฑฐ ํ๋ค
Name Type Description oDisplayObject
collie.DisplayObject nIdx
Number ์ธ๋ฑ์ค ๋ฒํธ๋ฅผ ์๊ณ ์๋ค๋ฉด ์ธ๋ฑ์ค ๋ฒํธ๋ฅผ ์ง์
-
inherited resizeFixedRatio(nWidth, nHeight)
-
์ง์ ํ ๋น์จ์ ๋ง๊ฒ ํฌ๊ธฐ๋ฅผ ๋ณ๊ฒฝ ํ๋ค. ๋ฆฌ์ํ๋ง๊ณผ๋ ๋ค๋ฅด๋ค ์ธ์ ๋ ์ค ํ๋๋ฅผ ์ค์ ํ๋ฉด ์ค์ ํ ๋ถ๋ถ์ ๋น์จ์ ๋ง์ถฐ์ ํฌ๊ธฐ๋ฅผ ๋ณ๊ฒฝ ํ๋ค
Name Type Description nWidth
Number optional ๋๋น
nHeight
Number optional ๋์ด
-
inherited right(nPosition){collie.DisplayObject}
-
๊ฐ์ฒด์ ์์น๋ฅผ ์ฐ์ธก ๊ธฐ์ค์ผ๋ก ์ขํ๋งํผ ์ด๋ํ๋ค ๋ง์ผ Layer์ ๋ถ์ ์ํ๊ฐ ์๋๋ผ๋ฉด ๋ถ์ ํ์ ์ด๋ํ ์ ์๋๋ก ํด ์ค๋ค
Name Type Description nPosition
Number ์ฐ์ธก ๊ธฐ์ค x์ขํ
Returns:
์์ ์ ๋ฐํ
-
inherited set(vKey, vValue, bSkipSetter, bSkipChanged){collie.DisplayObject}
-
์ค์ ๊ฐ์ ๋ณ๊ฒฝํ๋ค
Name Type Description vKey
String | Object ์ค์ ์ด๋ฆ. ์ฌ๋ฌ๊ฐ์ ๊ฐ์ Object๋ก ํ๋ฒ์ ์ค์ ํ ์ ์๋ค.
vValue
Variables ๊ฐ
bSkipSetter
Boolean optional setter๋ฅผ ์ํํ์ง ์์. ์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํ์ง ์๋๋ค
bSkipChanged
Boolean optional ์ํ ๋ณ๊ฒฝ์ ํ์ง ์๋๋ค. ์ํ๋ณ๊ฒฝ์ ํ์ง ์๊ฒ ๋๋ฉด ๋ค์ ๊ทธ๋ฆฌ์ง ์๋๋ค
Returns:
Method Chaining
Example
oDisplayObject.set({ visible : false, opacity : 1 });
oDisplayObject.set("visible", true);
-
inherited setDirty(sKey)
-
๊ฐ์ด ๋ณ๊ฒฝ๋ ๊ฒ์ผ๋ก ์ค์
Name Type Description sKey
String ํค ์ด๋ฆ, ๊ฐ์ด ์์ผ๋ฉด ๋ชจ๋ ๊ฐ์ ๋ค์ ์ ์ฉํจ
-
text(sText){collie.Text}
-
ํ ์คํธ๋ฅผ ์ด๋ค Write text
Name Type Description sText
String ์ถ๋ ฅํ ๋ฐ์ดํฐ text data
Returns:
์ฒด์ด๋์ ์ํด ์๊ธฐ ์์ ์ ๋ฐํ. return self instance for method chaining
-
toString(){String}
-
๋ฌธ์์ด๋ก ํด๋์ค ์ ๋ณด ๋ฐํ
-
inherited unset(sKey)
-
์ต์ ์ ์ ๊ฑฐํ๋ค
Name Type Description sKey
String
Events
-
inherited click
-
click ์ด๋ฒคํธ, ๋ชจ๋ฐ์ผ ํ๊ฒฝ์ผ ๋๋ touchstart, touchend๋ฅผ ๋น๊ตํด์ ์ขํ๊ฐ ์ผ์ ์ด๋ด๋ก ์์ง์์ ๊ฒฝ์ฐ click ์ด๋ฒคํธ๋ฅผ ๋ฐ์ํ๋คd
Name Type Description htEvent
Object Name Type Description displayObject
collie.DisplayObject ๋์ ๊ฐ์ฒด
event
HTMLEvent ์ด๋ฒคํธ ๊ฐ์ฒด
x
Number ์ด๋ฒคํธ ์๋ x ์ขํ
y
Number ์ด๋ฒคํธ ์๋ y ์ขํ
-
inherited mousedown
-
mousedown ์ด๋ฒคํธ, ๋ชจ๋ฐ์ผ ํ๊ฒฝ์ผ ๋๋ touchstart ์ด๋ฒคํธ๋ ํด๋น ๋๋ค.
Name Type Description htEvent
Object Name Type Description displayObject
collie.DisplayObject ๋์ ๊ฐ์ฒด
event
HTMLEvent ์ด๋ฒคํธ ๊ฐ์ฒด
x
Number ์ด๋ฒคํธ ์๋ x ์ขํ
y
Number ์ด๋ฒคํธ ์๋ y ์ขํ
-
inherited mouseup
-
mouseup ์ด๋ฒคํธ, ๋ชจ๋ฐ์ผ ํ๊ฒฝ์ผ ๋๋ touchend ์ด๋ฒคํธ๋ ํด๋น ๋๋ค.
Name Type Description htEvent
Object Name Type Description displayObject
collie.DisplayObject ๋์ ๊ฐ์ฒด
event
Event ์ด๋ฒคํธ ๊ฐ์ฒด
event
HTMLEvent ์ด๋ฒคํธ ๊ฐ์ฒด
x
Number ์ด๋ฒคํธ ์๋ x ์ขํ
y
Number ์ด๋ฒคํธ ์๋ y ์ขํ