_Button.js

ボタン情報を保持するオブジェクトです。

init() 関数内で以下のいずれかの設定を有効にする必要があります。
_USE_MOUSEマウスイベントを使用します。
_USE_TOUCHタッチイベントを使用します。

createButton

createButton(parent,src,x,y,width,height)

イメージリソースから _Button オブジェクトを構築して表示します。

パラメータ:
parent親の要素を指定します。
srcイメージリソースURL
x親の要素からの相対X座標
y親の要素からの相対Y座標
widthボタンの幅
heightボタンの高さ

戻り値:
構築された _Button オブジェクトを返します。

createButtonArea

createButtonArea(parent,src,x,y,width,height,areaName,shape,coords)

イメージリソースから _Button オブジェクトを構築して表示します。

パラメータ:
parent親の要素を指定します。
srcイメージリソースURL
x親の要素からの相対X座標
y親の要素からの相対Y座標
widthボタンの幅
heightボタンの高さ
areaName割り当てる一意のエリア名を指定します。
shape領域の形
coords領域の座標

戻り値:
構築された _Button オブジェクトを返します。

補足説明:
shape と coords には、以下の指定が有効です。
shapecoords
"circle""中心X座標,中心Y座標,半径"
"poly""X座標1,Y座標1,X座標2,Y座標2…"
"rect""左上X座標,左上Y座標,右下X座標,右下Y座標"

attachButton

attachButton(parent,id,x,y,width,height)

<img> 要素から _Button オブジェクトを構築して表示します。

パラメータ:
parent親の要素を指定します。
id<img> 要素の id 属性
x親の要素からの相対X座標
y親の要素からの相対Y座標
widthボタンの幅
heightボタンの高さ

戻り値:
構築された _Button オブジェクトを返します。

attachButtonArea

attachButtonArea(parent,id,x,y,width,height,areaId)

イメージマップの定義が関連付けられた <img> 要素から _Button オブジェクトを構築して表示します。

パラメータ:
parent親の要素を指定します。
id<img> 要素の id 属性
x親の要素からの相対X座標
y親の要素からの相対Y座標
widthボタンの幅
heightボタンの高さ
areaId<area> 要素の id 属性

戻り値:
構築された _Button オブジェクトを返します。

removeButton

removeButton(button)

ボタンを削除します。

パラメータ:
button_Button オブジェクト

補足説明:
createButton()/createButtonArea() で構築されたボタンのみ有効です。

buttonElement

buttonElement(button)

_Button オブジェクトの要素を取得します。

パラメータ:
button_Button オブジェクト

戻り値:
_Button オブジェクトの要素を返します。

buttonX

buttonX(button)

親の要素からの相対X座標を取得します。

パラメータ:
button_Button オブジェクト

戻り値:
親の要素からの相対X座標を返します。

buttonY

buttonY(button)

親の要素からの相対Y座標を取得します。

パラメータ:
button_Button オブジェクト

戻り値:
親の要素からの相対Y座標を返します。

buttonWidth

buttonWidth(button)

ボタンの幅を取得します。

パラメータ:
button_Button オブジェクト

戻り値:
ボタンの幅を返します。

buttonHeight

buttonHeight(button)

ボタンの高さを取得します。

パラメータ:
button_Button オブジェクト

戻り値:
ボタンの高さを返します。

setButtonSrc

setButtonSrc(button,src)

イメージリソースを差し替えます。

パラメータ:
button_Button オブジェクト
src新しいイメージリソースURL

setButtonX

setButtonX(button,x)

ボタンのX座標を変更します。

パラメータ:
button_Button オブジェクト
x親の要素からの相対X座標

setButtonY

setButtonY(button,y)

ボタンのY座標を変更します。

パラメータ:
button_Button オブジェクト
y親の要素からの相対Y座標

setButtonPos

setButtonPos(button,x,y)

ボタンの位置を変更します。

パラメータ:
button_Button オブジェクト
x親の要素からの相対X座標
y親の要素からの相対Y座標

setButtonWidth

setButtonWidth(button,width)

ボタンの幅を変更します。

パラメータ:
button_Button オブジェクト
widthボタンの幅

setButtonHeight

setButtonHeight(button,height)

ボタンの高さを変更します。

パラメータ:
button_Button オブジェクト
heightボタンの高さ

setButtonSize

setButtonSize(button,width,height)

ボタンの大きさを変更します。

パラメータ:
button_Button オブジェクト
widthボタンの幅
heightボタンの高さ

setButtonPosSize

setButtonPosSize(button,x,y,width,height)

ボタンの位置と大きさを変更します。

パラメータ:
button_Button オブジェクト
x親の要素からの相対X座標
y親の要素からの相対Y座標
widthボタンの幅
heightボタンの高さ

updateButtonPos

updateButtonPos(button)

親の要素のブラウザ画面内での座標が変更されたことを、ボタンに反映させます。

パラメータ:
button_Button オブジェクト

setButtonArea

setButtonArea(button,shape,coords)

領域を変更します。

パラメータ:
button_Button オブジェクト
shape領域の形
coords領域の座標

補足説明:
shape と coords には、以下の指定が有効です。
shapecoords
"circle""中心X座標,中心Y座標,半径"
"poly""X座標1,Y座標1,X座標2,Y座標2…"
"rect""左上X座標,左上Y座標,右下X座標,右下Y座標"