Krpano動態熱點添加始終顯示的文字


1.顯示 <scene> title 中的文字

在熱點的 onload 事件中加上 add_all_the_time_tooltip()

<hotspot name="spot1"  style="skin_hotspotstyle" 
            handcursor="true"
            zoom="false"
            onhover="set(autorotate.enabled, false);"
            onout="set(autorotate.enabled, true);"
            onloaded="add_all_the_time_tooltip()"
            onclick="loadscene(get(linkedscene))"
            ath="52.621" atv="19.322" linkedscene="scene_img2" tooltip="tooltip 1"/>

(或者在 <hotpsot> text 中添加顯示自定義的文字)

<hotspot name="spot1" 
                url="animatedhotspot_white.png" 
                onloaded="do_crop_animation(64,64, 60);"   
                ath="-15" atv="-12" 
                onclick="loadscene(get(linkedscene))" 
                text="自定義文字"/>

2.空白處加上 action

<action name="add_all_the_time_tooltip">
        txtadd(tooltipname, 'tooltip_', get(name));
        addplugin(get(tooltipname));
        txtadd(plugin[get(tooltipname)].parent, 'hotspot[', get(name), ']');
        set(plugin[get(tooltipname)].url,'%SWFPATH%/plugins/textfield.swf');
        set(plugin[get(tooltipname)].align,top);
        set(plugin[get(tooltipname)].edge,bottom);
        set(plugin[get(tooltipname)].x,0);
        set(plugin[get(tooltipname)].y,0);
        set(plugin[get(tooltipname)].autowidth,true);
        set(plugin[get(tooltipname)].autoheight,true);
        set(plugin[get(tooltipname)].vcenter,true);
        set(plugin[get(tooltipname)].background,true);
        set(plugin[get(tooltipname)].backgroundcolor,0x000000);
        set(plugin[get(tooltipname)].roundedge,5);
        set(plugin[get(tooltipname)].backgroundalpha,0.65);
        set(plugin[get(tooltipname)].padding,5);
        set(plugin[get(tooltipname)].border,false);
        set(plugin[get(tooltipname)].glow,0);
        set(plugin[get(tooltipname)].glowcolor,0xFFFFFF);
        set(plugin[get(tooltipname)].css,'text-align:center; color:#FFFFFF; font-family:MicrosoftYahei;  font-size:24px;');
        if(device.mobile,set(plugin[get(tooltipname)].css,'text-align:center; color:#FFFFFF; font-family:MicrosoftYahei; font-weight:bold; font-size:24px;');
            );
        set(plugin[get(tooltipname)].textshadow,0);
        set(plugin[get(tooltipname)].textshadowrange,6.0);
        set(plugin[get(tooltipname)].textshadowangle,90);
        if(text == '' OR text === null,
        copy(plugin[get(tooltipname)].html,scene[get(linkedscene)].title),
        copy(plugin[get(tooltipname)].html,text)
        );    
        set(plugin[get(tooltipname)].enabled,false);

3.vtorskin.xml也不要忘記寫上onload 和onclick事件

 

實現效果

附:krpano  - hotspot標簽中文說明熱(熱點設置)。

 
<hotspot name="..."              定義熱點名稱
         type="image"            定義熱點類型,只能是image
         url="..."               熱點圖像路徑,支持SWF, JPG, PNG, GIF
         alturl="..."            html5狀態下顯示的圖像路徑
         keep="false"            是否在下一場景跳轉后保持顯示
         devices="all"           支持設備類型
         visible="true"          是否可見
         enabled="true"          設置熱點是否接收鼠標事件
         handcursor="true"       設置是否鼠標移到上面顯示小手
         maskchildren="false"    設置是否將子控件變成蒙板
         zorder=""               插入元素的次序索引,可以是字符也可以是數字,html5輸出必須是0-100整數
         zorder2="0.0"           設置為0.0和1.0,分別對應當前熱點在扭曲控件之下和之上
         capture="true"          與enabled配合使用,都為true只對熱點傳遞動作,capture="false"可對子控件傳遞動作
         children="true"         設置子控件是否接收熱點鼠標事件
         blendmode="normal"      設置混合模式,可選:normal, layer, screen, add, subtract, difference, multiply, overlay, lighten, darken, hardlight, invert.
         style=""                讀入已設置好的style名稱
         ath="0.0" atv="0.0"     設定將場景縮略圖為球形熱點
         edge="center"           熱點的邊界對齊點
         ox="0"                  邊界到對齊點的偏移量
         oy="0"                  
         zoom="false"            設置是否場景縮放時,熱點跟隨縮放
         distorted="false" rx="0.0" ry="0.0" rz="0.0"    設置熱點是否跟隨場景進行3D扭曲
         details="8"              熱點顯示的細節數量,默認為8
         inverserotation="false"  設置是否逆向旋轉3D扭曲
         flying="0.0"             設置ath/atv/scale的插值 
         width="" height=""       設置熱點寬高
         scale="1.0"              設置熱點縮放
         rotate="0.0"             設置熱點旋轉角度
         pixelhittest="false"     是否啟動精確像素測試
         smoothing="true"         設置縮放時,是否平滑化處理
         accuracy="0"             設置像素渲染值(flash下)
         accuracy2="1"            設置精度控制(html5下)
         alpha="1.0"              設置透明度
         autoalpha="false"        設置是否自動變更透明度
         usecontentsize="false"   是否使用用戶指定flash大小,默認false原始大小
         scale9grid=""            定義是否支持矢量縮放,scale9grid="x-position|y-position|width|height|prescale*"
         crop=""                  定義元素坐標及寬高  crop="x-position|y-position|width|height"
         onovercrop=""          設置元素鼠標移到上方后的坐標及寬高
         ondowncrop=""          設置元素鼠標按下狀態后的坐標及寬高
         scalechildren="false"   子元素是否跟隨縮放
         mask=""                 mask="name"  mask="layer[name]"  mask="hotspot[name]"
         effect=""                熱點位圖效果3種:glow(color,alpha,range,strength);
                                  dropshadow(depth,angle,color,range,strength);
                                  blur(radius);
         onover=""               鼠標在經過上方時執行動作
         onhover=""              鼠標停在上方時執行動作
         onout=""                鼠標停移出范圍時時執行動作
         οnclick=""              鼠標停點擊時執行動作
         ondown=""               鼠標按下時執行動作
         onup=""                 鼠標按鍵松開時執行動作
         onloaded=""             加載元素完成后執行動作
         />
 
 
 
 
多邊形熱點
 
<hotspot name="..."
         keep="false"
         visible="true"
         enabled="true"
         handcursor="true"
         zorder=""
         capture="true"
         blendmode="normal"
         style=""
         alpha="1.0"
         autoalpha="false"
         fillcolor="0xFFFFFF" fillcolorhover="0xFFFFFF"   填充顏色及鼠標移上后顏色
         fillalpha="0.0" fillalphahover="0.1"             填充顏色透明度及鼠標移上后顏色透明度
         borderwidth="0.0" borderwidthhover="4.0"         邊界寬度及鼠標移上后邊界寬度
         bordercolor="0xFFFFFF" bordercolorhover="0xFFFFFF"  邊界顏色及邊界鼠標移上后顏色
         borderalpha="0.0" borderalphahover="0.8"           邊界透明度及鼠標移上后邊界透明度
         fadeintime="0.15" fadeincurve="1.1"               懸停狀態變化時間及形式
         fadeouttime="0.3" fadeoutcurve="0.7"
         onover=""
         onhover=""
         onout=""
         οnclick=""
         ondown=""
         onup=""
>
    <point ath="..." atv="..." />            多邊形熱點坐標
    <point ath="..." atv="..." />
    <point ath="..." atv="..." />
    ...
</hotspot>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM