1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486 |
- /**
- * $Id: mxAndroid.js,v 1.5 2014/01/21 12:32:06 mate Exp $
- * Copyright (c) 2006-2013, JGraph Ltd
- */
- //**********************************************************************************************************************************************************
- //Horizontal Tab Bar (LEGACY)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidTabBar(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidTabBar, mxShape);
- mxShapeAndroidTabBar.prototype.cst = {
- MAIN_TEXT : 'mainText',
- SHAPE_TAB_BAR : 'mxgraph.android.tabBar',
- TEXT_COLOR : 'textColor',
- TEXT_COLOR2 : 'textColor2',
- STROKE_COLOR2 : 'strokeColor2',
- FILL_COLOR2 : 'fillColor2',
- SELECTED : '+', //must be 1 char
- TEXT_SIZE : 'textSize'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidTabBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var textStrings = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.MAIN_TEXT, '+Tab 1, Tab 2, Tab 3').toString().split(',');
- var fontColor = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.TEXT_COLOR, 'none');
- var selectedFontColor = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.TEXT_COLOR2, 'none');
- var fontSize = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.TEXT_SIZE, '17').toString();
- var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none');
- var separatorColor = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.STROKE_COLOR2, 'none');
- var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
- var selectedFillColor = mxUtils.getValue(this.style, mxShapeAndroidTabBar.prototype.cst.FILL_COLOR2, 'none');
- var buttonNum = textStrings.length;
- var buttonWidths = new Array(buttonNum);
- var buttonTotalWidth = 0;
- var selectedButton = -1;
- var labelOffset = 5;
- for (var i = 0; i < buttonNum; i++)
- {
- var buttonText = textStrings[i];
- if(buttonText.charAt(0) === mxShapeAndroidTabBar.prototype.cst.SELECTED)
- {
- buttonText = textStrings[i].substring(1);
- selectedButton = i;
- }
- buttonWidths[i] = mxUtils.getSizeForString(buttonText, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
- buttonTotalWidth += buttonWidths[i];
- }
- var trueH = Math.max(h, fontSize * 1.5, 7);
- var minW = 2 * labelOffset * buttonNum + buttonTotalWidth;
- var trueW = Math.max(w, minW);
- c.translate(x, y);
- this.background(c, trueW, trueH, buttonNum, buttonWidths, labelOffset, minW, frameColor, separatorColor, bgColor, selectedFillColor, selectedButton);
- c.setShadow(false);
- c.setFontStyle(mxConstants.FONT_BOLD);
- var currWidth = 0;
- for (var i = 0; i < buttonNum; i++)
- {
- if (i === selectedButton)
- {
- c.setFontColor(selectedFontColor);
- }
- else
- {
- c.setFontColor(fontColor);
- }
- currWidth = currWidth + labelOffset;
- this.buttonText(c, currWidth, trueH, textStrings[i], buttonWidths[i], fontSize, minW, trueW);
- currWidth = currWidth + buttonWidths[i] + labelOffset;
- }
- };
- mxShapeAndroidTabBar.prototype.background = function(c, w, h, buttonNum, buttonWidths, labelOffset, minW, frameColor, separatorColor, bgColor, selectedFillColor, selectedButton)
- {
- c.begin();
- //draw the frame
- c.setStrokeColor(frameColor);
- c.setFillColor(bgColor);
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- //draw the button separators
- c.setStrokeColor(separatorColor);
- c.begin();
- for (var i = 1; i < buttonNum; i++)
- {
- if (i !== selectedButton && i !== (selectedButton + 1))
- {
- var currWidth = 0;
- for (var j = 0; j < i; j++)
- {
- currWidth += buttonWidths[j] + 2 * labelOffset;
- }
- currWidth = currWidth * w / minW;
- c.moveTo(currWidth, h * 0.2);
- c.lineTo(currWidth, h * 0.8);
- }
- }
- c.stroke();
- //draw the selected button
- var buttonLeft = 0;
- c.setFillColor(selectedFillColor);
- for (var i = 0; i < selectedButton; i++)
- {
- buttonLeft += buttonWidths[i] + 2 * labelOffset;
- }
- buttonLeft = buttonLeft * w / minW;
- var buttonRight = (buttonWidths[selectedButton] + 2 * labelOffset) * w / minW;
- buttonRight += buttonLeft;
- c.rect(buttonLeft, 0, buttonRight - buttonLeft, h);
- c.fill();
- c.setAlpha(1);
- c.setFillColor('#33b5e5');
- c.rect(buttonLeft, h * 0.9, buttonRight - buttonLeft, h * 0.1);
- c.fill();
- };
- mxShapeAndroidTabBar.prototype.buttonText = function(c, w, h, textString, buttonWidth, fontSize, minW, trueW)
- {
- if(textString.charAt(0) === mxShapeAndroidTabBar.prototype.cst.SELECTED)
- {
- textString = textString.substring(1);
- }
- c.begin();
- c.setFontSize(fontSize);
- c.text((w + buttonWidth * 0.5) * trueW / minW, h * 0.5, 0, 0, textString, mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeAndroidTabBar.prototype.cst.SHAPE_TAB_BAR] = mxShapeAndroidTabBar;
- //**********************************************************************************************************************************************************
- //Android Phone Vertical
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidPhone(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidPhone, mxShape);
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidPhone.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var rSize = 25;
- c.roundrect(0, 0, w, h, rSize, rSize);
- c.fillAndStroke();
-
- c.setShadow(false);
-
- this.foreground(c, x, y, w, h, rSize);
- };
- mxShapeAndroidPhone.prototype.foreground = function(c, x, y, w, h, rSize)
- {
- c.rect(w * 0.0625, h * 0.15, w * 0.875, h * 0.7);
- c.stroke();
- c.ellipse(w * 0.4875, h * 0.04125, w * 0.025, h * 0.0125);
- c.stroke();
- c.roundrect(w * 0.375, h * 0.075, w * 0.25, h * 0.01875, w * 0.02, h * 0.01);
- c.stroke();
- c.ellipse(w * 0.4, h * 0.875, w * 0.2, h * 0.1);
- c.stroke();
- c.roundrect(w * 0.4575, h * 0.905, w * 0.085, h * 0.04375, h * 0.00625, h * 0.00625);
- c.stroke();
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.phone'] = mxShapeAndroidPhone;
- //**********************************************************************************************************************************************************
- //Android Status Bar
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidStatusBar(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidStatusBar, mxShape);
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidStatusBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, x, y, w, h);
- c.setShadow(false);
- this.foreground(c, x, y, w, h);
- };
- mxShapeAndroidStatusBar.prototype.background = function(c, x, y, w, h)
- {
- c.rect(0, 0, w, h);
- c.fill();
- };
- mxShapeAndroidStatusBar.prototype.foreground = function(c, x, y, w, h)
- {
- c.rect(0, 0, w, h);
- c.fill();
- c.setFontColor(mxUtils.getValue(this.style, mxConstants.STYLE_FONTCOLOR, '#222222'));
- c.setFontSize(mxUtils.getValue(this.style, mxConstants.STYLE_FONTSIZE, '5'));
- c.text(w - 30, h * 0.5 + 1, 0, 0, '12:00', mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.setFillColor('#444444');
- c.begin();
- c.moveTo(w - 37, h * 0.5 + 6);
- c.lineTo(w - 37, h * 0.5 - 5);
- c.lineTo(w - 36, h * 0.5 - 5);
- c.lineTo(w - 36, h * 0.5 - 6);
- c.lineTo(w - 32, h * 0.5 - 6);
- c.lineTo(w - 32, h * 0.5 - 5);
- c.lineTo(w - 31, h * 0.5 - 5);
- c.lineTo(w - 31, h * 0.5 + 6);
- c.close();
- c.fill();
-
- c.setFillColor(mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none'));
- c.ellipse(w - 56, h * 0.5 + 2, 2, 2);
- c.fillAndStroke();
-
- c.setStrokeWidth(2);
- c.begin();
- c.moveTo(w - 52, h * 0.5 + 1);
- c.arcTo(3.5, 3.5, 0, 0, 0, w - 58, h * 0.5 + 1);
- c.stroke();
-
- c.begin();
- c.moveTo(w - 50, h * 0.5 - 1);
- c.arcTo(6, 6, 0, 0, 0, w - 60, h * 0.5 - 1);
- c.stroke();
-
- c.setStrokeWidth(1);
-
- c.rect(w - 51, h * 0.5 + 5, 2, 1);
- c.fill();
-
- c.rect(w - 48, h * 0.5 + 2, 2, 4);
- c.fill();
-
- c.rect(w - 45, h * 0.5 - 1, 2, 7);
- c.fill();
-
- c.rect(w - 42, h * 0.5 - 4, 2, 10);
- c.fill();
- c.rect(w - 37, h * 0.5 - 2, 6, 8);
- c.fill();
-
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.statusBar'] = mxShapeAndroidStatusBar;
- //**********************************************************************************************************************************************************
- //Checkbox Button Group
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidCheckboxGroup(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidCheckboxGroup, mxShape);
- mxShapeAndroidCheckboxGroup.prototype.cst = {
- STYLE_TEXTCOLOR2 : 'textColor2',
- STYLE_STROKECOLOR2 : 'strokeColor2',
- BUTTON_TEXT : 'buttonText',
- SELECTED : '+' //has to be one character long
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidCheckboxGroup.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var fontColor = mxUtils.getValue(this.style, mxConstants.STYLE_TEXTCOLOR, '#666666');
- var fontSize = mxUtils.getValue(this.style, mxConstants.STYLE_FONTSIZE, '8').toString();
- var optionText = mxUtils.getValue(this.style, mxShapeAndroidCheckboxGroup.prototype.cst.BUTTON_TEXT, 'Option 1').toString().split(',');
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none');
- var strokeColor2 = mxUtils.getValue(this.style, mxShapeAndroidCheckboxGroup.prototype.cst.STYLE_STROKECOLOR2, 'none');
-
- c.setStrokeColor(strokeColor2);
- var optionNum = optionText.length;
- var buttonSize = 5;
- var lineH = Math.max(fontSize * 1.5, buttonSize);
- var maxTextWidth = 0;
- var selected = -1;
- var labelOffset = 2.5;
- var minH = optionNum * lineH;
- var trueH = Math.max(h, minH);
- //get min width and selected option
- for (var i = 0; i < optionNum; i++)
- {
- var currText = optionText[i];
- if(currText.charAt(0) === mxShapeAndroidCheckboxGroup.prototype.cst.SELECTED)
- {
- currText = optionText[i].substring(1);
- selected = i;
- }
- var currWidth = mxUtils.getSizeForString(currText, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
- if (currWidth > maxTextWidth)
- {
- maxTextWidth = currWidth;
- }
- }
- var minW = 2 * labelOffset + maxTextWidth + 2 * buttonSize;
- var trueW = Math.max(w, minW);
- //draw the background
- c.roundrect(0, 0, trueW, trueH, 2.5, 2.5);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFontSize(fontSize);
- c.setFontColor(fontColor);
- c.setStrokeColor(strokeColor);
- for (var i = 0; i < optionNum; i++)
- {
- var currHeight = (i * lineH + lineH * 0.5) * trueH / minH;
- var currText = optionText[i];
- if(currText.charAt(0) === mxShapeAndroidCheckboxGroup.prototype.cst.SELECTED)
- {
- currText = optionText[i].substring(1);
- selected = i;
- }
- c.text(buttonSize * 2 + labelOffset, currHeight, 0, 0, currText, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- var iconX = buttonSize * 0.5;
- var iconY = currHeight - buttonSize * 0.5;
- if (selected === i)
- {
- c.rect(iconX, iconY, buttonSize, buttonSize);
- c.fillAndStroke();
- c.begin();
- c.moveTo(iconX + buttonSize * 0.25, iconY + buttonSize * 0.5);
- c.lineTo(iconX + buttonSize * 0.5, iconY + buttonSize * 0.75);
- c.lineTo(iconX + buttonSize * 0.75, iconY + buttonSize * 0.25);
- c.stroke();
- }
- else
- {
- c.rect(iconX, iconY, buttonSize, buttonSize);
- c.fillAndStroke();
- }
- selected = -1;
- }
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.checkboxGroup'] = mxShapeAndroidCheckboxGroup;
- //**********************************************************************************************************************************************************
- //Radio Button Group
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidRadioGroup(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidRadioGroup, mxShape);
- mxShapeAndroidRadioGroup.prototype.cst = {
- STYLE_TEXTCOLOR2 : 'textColor2',
- STYLE_STROKECOLOR2 : 'strokeColor2',
- BUTTON_TEXT : 'buttonText',
- SELECTED : '+' //has to be one character long
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidRadioGroup.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var fontColor = mxUtils.getValue(this.style, mxConstants.STYLE_TEXTCOLOR, '#666666');
- var fontSize = mxUtils.getValue(this.style, mxConstants.STYLE_FONTSIZE, '8').toString();
- var optionText = mxUtils.getValue(this.style, mxShapeAndroidRadioGroup.prototype.cst.BUTTON_TEXT, 'Option 1').toString().split(',');
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none');
- var strokeColor2 = mxUtils.getValue(this.style, mxShapeAndroidRadioGroup.prototype.cst.STYLE_STROKECOLOR2, 'none');
- c.setStrokeColor(strokeColor2);
- var optionNum = optionText.length;
- var buttonSize = 5;
- var lineH = Math.max(fontSize * 1.5, buttonSize);
- var maxTextWidth = 0;
- var selected = -1;
- var labelOffset = 2.5;
- var minH = optionNum * lineH;
- var trueH = Math.max(h, minH);
- //get min width and selected option
- for (var i = 0; i < optionNum; i++)
- {
- var currText = optionText[i];
- if(currText.charAt(0) === mxShapeAndroidRadioGroup.prototype.cst.SELECTED)
- {
- currText = optionText[i].substring(1);
- selected = i;
- }
- var currWidth = mxUtils.getSizeForString(currText, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
- if (currWidth > maxTextWidth)
- {
- maxTextWidth = currWidth;
- }
- }
- var minW = 2 * labelOffset + maxTextWidth + 2 * buttonSize;
- var trueW = Math.max(w, minW);
- //draw the background
- c.roundrect(0, 0, trueW, trueH, 2.5, 2.5);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFontSize(fontSize);
- c.setFontColor(fontColor);
- c.setStrokeColor(strokeColor);
- c.setFillColor(strokeColor);
- for (var i = 0; i < optionNum; i++)
- {
- var currHeight = (i * lineH + lineH * 0.5) * trueH / minH;
- var currText = optionText[i];
- if(currText.charAt(0) === mxShapeAndroidRadioGroup.prototype.cst.SELECTED)
- {
- currText = optionText[i].substring(1);
- selected = i;
- }
- c.text(buttonSize * 2 + labelOffset, currHeight, 0, 0, currText, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- var iconX = buttonSize * 0.5;
- var iconY = currHeight - buttonSize * 0.5;
- if (selected === i)
- {
- c.ellipse(iconX, iconY, buttonSize, buttonSize);
- c.stroke();
- c.ellipse(iconX + buttonSize * 0.25, iconY + buttonSize * 0.25, buttonSize * 0.5, buttonSize * 0.5);
- c.fillAndStroke();
- }
- else
- {
- c.ellipse(iconX, iconY, buttonSize, buttonSize);
- c.stroke();
- }
- }
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.radioGroup'] = mxShapeAndroidRadioGroup;
- //**********************************************************************************************************************************************************
- //Menu Bar (LEGACY)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidMenuBar(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidMenuBar, mxShape);
- mxShapeAndroidMenuBar.prototype.cst = {
- MENU_TEXT : 'menuText'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidMenuBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var textStrings = mxUtils.getValue(this.style, mxShapeAndroidMenuBar.prototype.cst.MENU_TEXT, 'Item 1, Item 2, Item 3').toString().split(',');
- var fontSize = mxUtils.getValue(this.style, mxConstants.STYLE_FONTSIZE, '12');
- var buttonNum = textStrings.length;
- var maxButtonWidth = 0;
- var labelOffset = 2.5;
- for (var i = 0; i < buttonNum; i++)
- {
- var buttonText = textStrings[i];
- var currWidth = mxUtils.getSizeForString(buttonText, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
- if (currWidth > maxButtonWidth)
- {
- maxButtonWidth = currWidth;
- }
- }
- var minButtonHeight = fontSize * 1.5;
- var minH = buttonNum * minButtonHeight;
- var trueH = Math.max(h, minH);
- var minW = 2 * labelOffset + maxButtonWidth;
- var trueW = Math.max(w, minW);
- c.translate(x, y);
- c.rect(0, 0, w, trueH);
- c.fillAndStroke();
- c.setShadow(false);
- //draw the button separators
- c.begin();
- for (var i = 1; i < buttonNum; i++)
- {
- var currHeight = i * minButtonHeight * trueH / minH;
- c.moveTo(0, currHeight);
- c.lineTo(w, currHeight);
- }
- c.stroke();
- for (var i = 0; i < buttonNum; i++)
- {
- currWidth = currWidth + labelOffset;
- var currHeight = (i * minButtonHeight + minButtonHeight * 0.5) * trueH / minH;
- c.text(10, currHeight, 0, 0, textStrings[i], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- }
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.menuBar'] = mxShapeAndroidMenuBar;
- //**********************************************************************************************************************************************************
- //Text Selection Handles
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidTextSelHandles(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidTextSelHandles, mxShape);
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidTextSelHandles.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, 'none');
- c.translate(x, y);
- var handleSizeX = 15;
- var barH = Math.max(0, h - handleSizeX * 1.5);
- c.setAlpha(0.5);
-
- c.rect(handleSizeX, 0, w - 2 * handleSizeX, barH);
- c.fill();
-
- c.begin();
- c.moveTo(0, h - handleSizeX);
- c.lineTo(handleSizeX * 0.5, h - handleSizeX * 1.5);
- c.lineTo(handleSizeX, h - handleSizeX);
- c.close();
- c.moveTo(w - handleSizeX, h - handleSizeX);
- c.lineTo(w - handleSizeX * 0.5, h - handleSizeX * 1.5);
- c.lineTo(w, h - handleSizeX);
- c.close();
- c.fill();
-
- c.setFillColor(strokeColor);
- c.rect(0, h - handleSizeX, handleSizeX, handleSizeX);
- c.fill();
- c.rect(w - handleSizeX, h - handleSizeX, handleSizeX, handleSizeX);
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.textSelHandles'] = mxShapeAndroidTextSelHandles;
- //**********************************************************************************************************************************************************
- //Android Indeterminate Spinner
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidIndeterminateSpinner(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidIndeterminateSpinner, mxShape);
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidIndeterminateSpinner.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, x, y, w, h);
- };
- mxShapeAndroidIndeterminateSpinner.prototype.background = function(c, x, y, w, h)
- {
- c.setGradient('#aaaaaa', '#dddddd', w * 0.325, 0, w * 0.675, h * 0.5, mxConstants.DIRECTION_SOUTH, 1, 1);
- c.begin();
- c.moveTo(w * 0.5, h * 0.1);
- c.arcTo(w * 0.4, h * 0.4, 0, 0, 0, w * 0.5, h * 0.9);
- c.lineTo(w * 0.5, h);
- c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, 0);
- c.close();
- c.fill();
- c.setGradient('#ffffff', '#dddddd', w * 0.325, 0, w * 0.675, h * 0.5, mxConstants.DIRECTION_SOUTH, 1, 1);
- c.begin();
- c.moveTo(w * 0.5, h * 0.1);
- c.arcTo(w * 0.4, h * 0.4, 0, 0, 1, w * 0.5, h * 0.9);
- c.lineTo(w * 0.5, h);
- c.arcTo(w * 0.5, h * 0.5, 0, 0, 0, w * 0.5, 0);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes['mxgraph.android.indeterminateSpinner'] = mxShapeAndroidIndeterminateSpinner;
- //**********************************************************************************************************************************************************
- //Anchor (a dummy shape without visuals used for anchoring)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidAnchor(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidAnchor, mxShape);
- mxShapeAndroidAnchor.prototype.cst = {
- ANCHOR : 'mxgraph.android.anchor'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- };
- mxCellRenderer.registerShape(mxShapeAndroidAnchor.prototype.cst.ANCHOR, mxShapeAndroidAnchor);
- //**********************************************************************************************************************************************************
- //Rounded rectangle (adjustable rounding)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidRRect(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidRRect, mxShape);
- mxShapeAndroidRRect.prototype.cst = {
- RRECT : 'mxgraph.android.rrect',
- R_SIZE : 'rSize'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidRRect.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var rSize = parseInt(mxUtils.getValue(this.style, mxShapeAndroidRRect.prototype.cst.R_SIZE, '10'));
- c.roundrect(0, 0, w, h, rSize);
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidRRect.prototype.cst.RRECT, mxShapeAndroidRRect);
- //**********************************************************************************************************************************************************
- //Checkbox
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidCheckbox(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidCheckbox, mxShape);
- mxShapeAndroidCheckbox.prototype.cst = {
- CHECKBOX : 'mxgraph.android.checkbox'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidCheckbox.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- c.rect(0, 0, w, h);
- c.fillAndStroke();
-
- c.begin();
- c.moveTo(w * 0.8, h * 0.2);
- c.lineTo(w * 0.4, h * 0.8);
- c.lineTo(w * 0.25, h * 0.6);
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidCheckbox.prototype.cst.CHECKBOX, mxShapeAndroidCheckbox);
- //**********************************************************************************************************************************************************
- //Progress Bar
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidProgressBar(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx1 = 0.8;
- this.dx2 = 0.6;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidProgressBar, mxShape);
- mxShapeAndroidProgressBar.prototype.cst = {
- PROGRESS_BAR : 'mxgraph.android.progressBar'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidProgressBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dx1 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
- var dx2 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
- c.translate(x, y);
-
- c.save();
- c.save();
- c.setStrokeColor('#444444');
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(w , h * 0.5);
- c.stroke();
-
- c.restore();
- c.setShadow(false);
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(dx1, h * 0.5);
- c.stroke();
-
- c.setStrokeColor('#000000');
- c.setAlpha('0.2');
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(dx1, h * 0.5);
- c.stroke();
-
- c.restore();
- c.setShadow(false);
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(dx2, h * 0.5);
- c.stroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidProgressBar.prototype.cst.PROGRESS_BAR, mxShapeAndroidProgressBar);
- mxShapeAndroidProgressBar.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidProgressBar.prototype.cst.PROGRESS_BAR] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx1'], function(bounds)
- {
- var dx1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
- return new mxPoint(bounds.x + dx1 * bounds.width, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
- })];
- var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)
- {
- var dx2 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx1))));
- return new mxPoint(bounds.x + dx2 * bounds.width, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
- });
-
- handles.push(handle2);
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Progress Scrubber Disabled
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidProgressScrubberDisabled(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.3;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidProgressScrubberDisabled, mxShape);
- mxShapeAndroidProgressScrubberDisabled.prototype.cst = {
- PROGRESS_SCRUBBER_DISABLED : 'mxgraph.android.progressScrubberDisabled'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidProgressScrubberDisabled.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- c.translate(x, y);
-
- c.save();
- c.save();
- c.setStrokeColor('#444444');
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(w, h * 0.5);
- c.stroke();
-
- c.restore();
- c.setShadow(false);
- c.setAlpha('0.5');
- c.setFillColor('#666666');
- c.begin();
- var r = Math.min(h, w * 0.1) / 2;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fill();
-
- c.restore();
- c.setShadow(false);
- c.begin();
- var r = Math.min(h, w * 0.1) / 8;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fill();
-
- };
- mxCellRenderer.registerShape(mxShapeAndroidProgressScrubberDisabled.prototype.cst.PROGRESS_SCRUBBER_DISABLED, mxShapeAndroidProgressScrubberDisabled);
- mxShapeAndroidProgressScrubberDisabled.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidProgressScrubberDisabled.prototype.cst.PROGRESS_SCRUBBER_DISABLED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx'], function(bounds)
- {
- var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + dx * bounds.width, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Progress Scrubber Focused
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidProgressScrubberFocused(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.3;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidProgressScrubberFocused, mxShape);
- mxShapeAndroidProgressScrubberFocused.prototype.cst = {
- PROGRESS_SCRUBBER_FOCUSED : 'mxgraph.android.progressScrubberFocused'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidProgressScrubberFocused.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
- c.translate(x, y);
-
- c.save();
- c.save();
- c.setStrokeColor('#444444');
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(w, h * 0.5);
- c.stroke();
-
- c.restore();
- c.setShadow(false);
- c.setAlpha('0.75');
- c.begin();
- var r = Math.min(h, w * 0.1) / 2;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fill();
-
- c.restore();
- c.setShadow(false);
- c.setStrokeColor(fillColor);
-
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(dx, h * 0.5);
- c.stroke();
-
- c.begin();
- var r = Math.min(h, w * 0.1) / 8;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fill();
-
- };
- mxCellRenderer.registerShape(mxShapeAndroidProgressScrubberFocused.prototype.cst.PROGRESS_SCRUBBER_FOCUSED, mxShapeAndroidProgressScrubberFocused);
- mxShapeAndroidProgressScrubberFocused.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidProgressScrubberFocused.prototype.cst.PROGRESS_SCRUBBER_FOCUSED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx'], function(bounds)
- {
- var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + dx * bounds.width, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Progress Scrubber Pressed
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidProgressScrubberPressed(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dx = 0.3;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidProgressScrubberPressed, mxShape);
- mxShapeAndroidProgressScrubberPressed.prototype.cst = {
- PROGRESS_SCRUBBER_PRESSED : 'mxgraph.android.progressScrubberPressed'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidProgressScrubberPressed.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
- var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
- c.translate(x, y);
-
- c.save();
- c.save();
- c.setStrokeColor('#444444');
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(w, h * 0.5);
- c.stroke();
-
- c.restore();
- c.setShadow(false);
- c.setStrokeColor(fillColor);
- c.setAlpha('0.5');
- c.begin();
- var r = Math.min(h, w * 0.1) / 2;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fillAndStroke();
-
- c.restore();
- c.setShadow(false);
- c.setStrokeColor(fillColor);
-
- c.begin();
- c.moveTo(0, h * 0.5);
- c.lineTo(dx, h * 0.5);
- c.stroke();
-
- c.begin();
- var r = Math.min(h, w * 0.1) / 8;
- c.ellipse(dx - r, h * 0.5 - r, 2 * r, 2 * r);
- c.fill();
-
- };
- mxCellRenderer.registerShape(mxShapeAndroidProgressScrubberPressed.prototype.cst.PROGRESS_SCRUBBER_PRESSED, mxShapeAndroidProgressScrubberPressed);
- mxShapeAndroidProgressScrubberPressed.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidProgressScrubberPressed.prototype.cst.PROGRESS_SCRUBBER_PRESSED] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx'], function(bounds)
- {
- var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + dx * bounds.width, bounds.y + bounds.height / 2);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Quickscroll
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidQuickscroll2(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidQuickscroll2, mxShape);
- mxShapeAndroidQuickscroll2.prototype.cst = {
- QUICKSCROLL : 'mxgraph.android.quickscroll2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidQuickscroll2.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dy = Math.min(h - 20, Math.max(20, h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))))));
- var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
- c.translate(x, y);
-
- c.save();
- c.save();
- c.setStrokeColor('#cccccc');
- c.begin();
- c.moveTo(w - 3, 0);
- c.lineTo(w - 3, h);
- c.stroke();
-
- c.restore();
- c.begin();
- c.roundrect(w - 6, dy - 10, 6, 20, 1, 1);
- c.fillAndStroke();
-
- c.setFillColor('#cccccc');
- c.begin();
- c.rect(0, dy - 20, w - 18, 40);
- c.fill();
-
- c.setFillColor('#666666');
- c.begin();
- c.moveTo(w - 18, dy - 20);
- c.lineTo(w - 6, dy);
- c.lineTo(w - 18, dy + 20);
- c.close();
- c.fill();
-
- c.setFontSize('12');
- c.text((w - 18) * 0.5, dy, 0, 00, 'Aa', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- };
- mxCellRenderer.registerShape(mxShapeAndroidQuickscroll2.prototype.cst.QUICKSCROLL, mxShapeAndroidQuickscroll2);
- mxShapeAndroidQuickscroll2.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidQuickscroll2.prototype.cst.QUICKSCROLL] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dy'], function(bounds)
- {
- var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width - 3, bounds.y + Math.min(bounds.height - 20, Math.max(20, dy * bounds.height)));
- }, function(bounds, pt)
- {
- this.state.style['dy'] = Math.round(1000 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 1000;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Quickscroll2
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidQuickscroll3(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.dy = 0.5;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidQuickscroll3, mxShape);
- mxShapeAndroidQuickscroll3.prototype.cst = {
- QUICKSCROLL : 'mxgraph.android.quickscroll3'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidQuickscroll3.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var dy = Math.min(h - 10, Math.max(10, h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))))));
- var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
- c.translate(x, y);
-
- c.save();
- c.setStrokeColor('#cccccc');
- c.begin();
- c.moveTo(w * 0.5, 0);
- c.lineTo(w * 0.5, h);
- c.stroke();
-
- c.restore();
- c.begin();
- c.roundrect(w * 0.5 - 3, dy - 10, 6, 20, 1, 1);
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidQuickscroll3.prototype.cst.QUICKSCROLL, mxShapeAndroidQuickscroll3);
- mxShapeAndroidQuickscroll3.prototype.constraints = null;
- Graph.handleFactory[mxShapeAndroidQuickscroll3.prototype.cst.QUICKSCROLL] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dy'], function(bounds)
- {
- var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
- return new mxPoint(bounds.x + bounds.width * 0.5, bounds.y + Math.min(bounds.height - 10, Math.max(10, dy * bounds.height)));
- }, function(bounds, pt)
- {
- this.state.style['dy'] = Math.round(1000 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 1000;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Scrollbars
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidScrollbars2(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidScrollbars2, mxShape);
- mxShapeAndroidScrollbars2.prototype.cst = {
- SCROLLBARS : 'mxgraph.android.scrollbars2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidScrollbars2.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
-
- c.begin();
- c.rect(w - 5, 0, 5, h - 7);
- c.fillAndStroke();
- c.begin();
- c.rect(0, h - 5, w - 7, 5);
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidScrollbars2.prototype.cst.SCROLLBARS, mxShapeAndroidScrollbars2);
- mxShapeAndroidScrollbars2.prototype.constraints = null;
- //**********************************************************************************************************************************************************
- //Spinner
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeAndroidSpinner2(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeAndroidSpinner2, mxShape);
- mxShapeAndroidSpinner2.prototype.cst = {
- SPINNER : 'mxgraph.android.spinner2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeAndroidSpinner2.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
-
- c.begin();
- c.moveTo(0, h);
- c.lineTo(w, h);
- c.stroke();
-
- var s = Math.min(w / 10, h)
- c.begin();
- c.moveTo(w - s, h);
- c.lineTo(w, h - s);
- c.lineTo(w, h);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeAndroidSpinner2.prototype.cst.SPINNER, mxShapeAndroidSpinner2);
- mxShapeAndroidSpinner2.prototype.constraints = null;
|