contentview_Gomu.js 7.4 KB
Newer Older
Motohisa Nakano committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
/// コンテンツ閲覧画面_消しゴム書式オーバーレイ
/// <reference path="../common/js/avweb.js" />

/// <reference path="../common/js/screenLock.js" />

/// <reference path="../common/js/common.js" />

/// <reference path="../common/js/i18n.js" />

/// <reference path="../common/js/jquery-1.8.1.min.js" />

/// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" />

/// <reference path="../common/js/jquery.toastmessage.js" />

/// <reference path="../common/js/pageViewer.js" />

/// ===============================================================================================
/// Eraser group [start]
/// ===============================================================================================

// Show eraser
function ShowEraser(targetDiv) {
    
    //$('#dlgGomu').dialog("open");
    //$(".ui-dialog-titlebar").hide();
    //lockLayout();
    // $('#dlgGomu').fadeIn('medium', function(){
    	// $('#dlgGomu').draggable();
    // });
    $('#dlgGomu').show();
    $('#dlgGomu').draggable();
    Eraser_SetDefaultValue();
     $('#dlgGomu').center();
};
// Set default value for easer.
function Eraser_SetDefaultValue() {
    var typeValue = undefined;
    typeValue = ClientData.erase_size();
    if (typeValue == 5) {
        $("#dlgGomu_rdo1").attr('checked', 'checked');
        $("#dlgGomu_rdo1").focus();
    }
    else if (typeValue == 12.5) {
        $("#dlgGomu_rdo2").attr('checked', 'checked');
        $("#dlgGomu_rdo2").focus();
    }
    else if (typeValue == 25) {
        $("#dlgGomu_rdo3").attr('checked', 'checked');
        $("#dlgGomu_rdo3").focus();
    }
    else if (typeValue == 50) {
        $("#dlgGomu_rdo4").attr('checked', 'checked');
        $("#dlgGomu_rdo4").focus();
    }
    else {
        typeValue = 5;
        $("#dlgGomu_rdo1").attr('checked', 'checked');
        $("#dlgGomu_rdo1").focus();
    }
    dlgGomu_chooseType(typeValue);
};
// Choose type of eraser, and draw to canvas
function dlgGomu_chooseType(typeValue) {

    var canvas = document.getElementById('dlgGomu_cvMain');

    if (canvas.getContext) {
        
        // use getContext to use the canvas for drawing
        var ctx = canvas.getContext('2d');

        // Draw shapes
        ctx.fillStyle = "#888888";
        ctx.fillRect(0, 0, canvas.width, canvas.height);
        
        ctx.beginPath();
        //ctx.arc(60, 60, typeValue, 0, Math.PI * 2, true);  // Outer circle

        ctx.arc(canvas.width/2, canvas.height/2, typeValue, 0, 2 * Math.PI, true);
        ctx.fillStyle = "#ffffff";
        ctx.fill();
        ctx.stroke();

    }
};

function dlgGomu_rdo1_click() {
    dlgGomu_chooseType(5);
};
function dlgGomu_rdo2_click() {
    dlgGomu_chooseType(12.5);
};
function dlgGomu_rdo3_click() {
    dlgGomu_chooseType(25);
};
function dlgGomu_rdo4_click() {
    dlgGomu_chooseType(50);
};

// Event of button OK
function dlgGomu_dspOK_click() {

    // Set selected value to local storage
    var typeValue = undefined;

    if ($("#dlgGomu_rdo1").attr('checked') == 'checked') {
        typeValue = 5;
    }
    else if ($("#dlgGomu_rdo2").attr('checked') == 'checked') {
        typeValue = 12.5;
    }
    else if ($("#dlgGomu_rdo3").attr('checked') == 'checked') {
        typeValue = 25;
    }
    else if ($("#dlgGomu_rdo4").attr('checked') == 'checked') {
        typeValue = 50;
    }

    // Set value to local
    ClientData.erase_size(typeValue);
	eraseSize = typeValue;

    // Close dialog
    //$("#dlgGomu").dialog('close');
	/*$("#dlgGomu").fadeOut('medium', function(){
		//unlockLayout();
	});*/
	$("#dlgGomu").hide();
	
	/*enable button */
	enableButtonMarking();
	ClientData.IsAddingMarking(true);
	isAddingMarking = ClientData.IsAddingMarking();
	
	/* unlock dialog overlay */
	$("#overlay").hide();
	
	$('#dlgMarking_imgEraserOption').removeClass();
	$('#dlgMarking_imgEraserOption').addClass('eraser_option_hover');
};
// Event of button cancel
function dlgGomu_dspCancel_click() {

    // Close dialog
    //$("#dlgGomu").dialog('close');
	/*$("#dlgGomu").fadeOut('medium', function(){
		//unlockLayout();
	});*/
	$("#dlgGomu").hide();
	
	/*enable button */
	enableButtonMarking();
	ClientData.IsAddingMarking(true);
	isAddingMarking = ClientData.IsAddingMarking();
	
	/* unlock dialog overlay */
	$("#overlay").hide();
	
	$('#dlgMarking_imgEraserOption').removeClass();
	$('#dlgMarking_imgEraserOption').addClass('eraser_option_hover');
};

function dlgGomu_rdo1_text_click(){
	$('#dlgGomu_rdo1').attr('checked','checked');
	$('#dlgGomu_rdo2').removeAttr('checked');
	$('#dlgGomu_rdo3').removeAttr('checked');
	$('#dlgGomu_rdo4').removeAttr('checked');
	dlgGomu_rdo1_click();
};

function dlgGomu_rdo2_text_click(){
	$('#dlgGomu_rdo1').removeAttr('checked');
	$('#dlgGomu_rdo2').attr('checked','checked');
	$('#dlgGomu_rdo3').removeAttr('checked');
	$('#dlgGomu_rdo4').removeAttr('checked');
	dlgGomu_rdo2_click();
};

function dlgGomu_rdo3_text_click(){
	$('#dlgGomu_rdo1').removeAttr('checked');
	$('#dlgGomu_rdo2').removeAttr('checked');
	$('#dlgGomu_rdo3').attr('checked','checked');
	$('#dlgGomu_rdo4').removeAttr('checked');
	dlgGomu_rdo3_click();
};

function dlgGomu_rdo4_text_click(){
	$('#dlgGomu_rdo1').removeAttr('checked');
	$('#dlgGomu_rdo2').removeAttr('checked');
	$('#dlgGomu_rdo3').removeAttr('checked');
	$('#dlgGomu_rdo4').attr('checked','checked');
	dlgGomu_rdo4_click();
};
/*
----------------------------------------------------------------------------
Event groups [start]
----------------------------------------------------------------------------
*/


/*
----------------------------------------------------------------------------
Event groups [ end ]
----------------------------------------------------------------------------
*/


function touchStart_BtnOk_Gomu(e){
	e.preventDefault();
	$('#dlgGomu').draggable("destroy");
	
	
	dlgGomu_dspOK_click();
	
};

function touchStart_BtnCancel_Gomu(e){
	e.preventDefault();
	$('#dlgGomu').draggable("destroy");
	
	dlgGomu_dspCancel_click();
};

// Setting dialog
$(function () {
    // ---------------------------------
    // Setup for easer [start]
    // ---------------------------------
	if(isTouchDevice() == true){
		document.getElementById('dlgGomu_dspOK').addEventListener('touchstart',touchStart_BtnOk_Gomu,false);
	 	document.getElementById('dlgGomu_dspCancel').addEventListener('touchstart',touchStart_BtnCancel_Gomu,false);
	}
	
	
    $("#dlgGomu_dspOK").click(dlgGomu_dspOK_click);
    $("#dlgGomu_dspCancel").click(dlgGomu_dspCancel_click);

    // Event for radio
    $("#dlgGomu_rdo1").click(dlgGomu_rdo1_click);
    $("#dlgGomu_rdo2").click(dlgGomu_rdo2_click);
    $("#dlgGomu_rdo3").click(dlgGomu_rdo3_click);
    $("#dlgGomu_rdo4").click(dlgGomu_rdo4_click);
    
    // $("#dlgGomu_rdo1_text").click(dlgGomu_rdo1_text_click);
    // $("#dlgGomu_rdo2_text").click(dlgGomu_rdo2_text_click);
    // $("#dlgGomu_rdo3_text").click(dlgGomu_rdo3_text_click);
    // $("#dlgGomu_rdo4_text").click(dlgGomu_rdo4_text_click);

	//$('#dlgGomu_rdo1_text').click()
    // ---------------------------------
    // Setup for easer [ end ]
    // ---------------------------------
    /*$('#dlgGomu').dialog({
        autoOpen: false,
        title: i18nText('txtDltOpt'),
        modal: true,
        resizable: false,
        width: 450,
        height: 300
    });*/
});

/// ===============================================================================================
/// Eraser group [ end ]
/// ===============================================================================================