12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640 |
- /**
- * $Id: mxMockupMisc.js,v 1.5 2013/02/28 13:50:11 mate Exp $
- * Copyright (c) 2006-2010, JGraph Ltd
- */
- //**********************************************************************************************************************************************************
- //Playback Controls
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupPlaybackControls(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(mxShapeMockupPlaybackControls, mxShape);
- mxShapeMockupPlaybackControls.prototype.cst = {
- SHAPE_PLAYBACK_CONTROLS : 'mxgraph.mockup.misc.playbackControls',
- FILL_COLOR2 : 'fillColor2',
- STROKE_COLOR2 : 'strokeColor2',
- FILL_COLOR3 : 'fillColor3',
- STROKE_COLOR3 : 'strokeColor3'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupPlaybackControls.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var controlBarHeight = 30;
- var buttonSize = 22;
- var h = Math.max(h, controlBarHeight);
- var w = Math.max(225, w);
- c.translate(x, y);
- this.background(c, w, h, controlBarHeight);
- c.setShadow(false);
- this.foreground(c, w, h, controlBarHeight, buttonSize);
- };
- mxShapeMockupPlaybackControls.prototype.background = function(c, w, h, controlBarHeight)
- {
- c.rect(0, (h - controlBarHeight) * 0.5, w, controlBarHeight);
- c.fillAndStroke();
- }
- mxShapeMockupPlaybackControls.prototype.foreground = function(c, w, h, controlBarHeight, buttonSize)
- {
- var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.FILL_COLOR2, '#99ddff');
- var strokeColor2 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.STROKE_COLOR2, 'none');
- var fillColor3 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.FILL_COLOR3, '#ffffff');
- var strokeColor3 = mxUtils.getValue(this.style, mxShapeMockupPlaybackControls.prototype.cst.STROKE_COLOR3, 'none');
- c.setStrokeColor(strokeColor2);
- c.setFillColor(fillColor2);
- c.ellipse(10, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(40, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(70, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(100, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(130, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(160, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.ellipse(190, h * 0.5 - buttonSize * 0.5, buttonSize, buttonSize);
- c.fillAndStroke();
- c.setStrokeColor(strokeColor3);
- c.setFillColor(fillColor3);
- // start
- var t = h * 0.5 - controlBarHeight * 0.5;
- c.begin();
- c.moveTo(16, t + 10);
- c.lineTo(16, t + 20);
- c.lineTo(18, t + 20);
- c.lineTo(18, t + 10);
- c.close();
- c.moveTo(20, t + 15);
- c.lineTo(25, t + 20);
- c.lineTo(25, t + 10);
- c.close();
- c.fillAndStroke();
- // rewind
- c.begin();
- c.moveTo(44, t + 15);
- c.lineTo(49, t + 20);
- c.lineTo(49, t + 10);
- c.close();
- c.moveTo(51, t + 15);
- c.lineTo(56, t + 20);
- c.lineTo(56, t + 10);
- c.close();
- c.fillAndStroke();
- // back
- c.begin();
- c.moveTo(77, t + 15);
- c.lineTo(82, t + 20);
- c.lineTo(82, t + 10);
- c.close();
- c.fillAndStroke();
- // play/pause
- c.begin();
- c.moveTo(108, t + 10);
- c.lineTo(108, t + 20);
- c.lineTo(110, t + 20);
- c.lineTo(110, t + 10);
- c.close();
- c.moveTo(117, t + 15);
- c.lineTo(112, t + 20);
- c.lineTo(112, t + 10);
- c.close();
- c.fillAndStroke();
- // forward
- c.begin();
- c.moveTo(144, t + 15);
- c.lineTo(139, t + 20);
- c.lineTo(139, t + 10);
- c.close();
- c.fillAndStroke();
- // fast forward
- c.begin();
- c.moveTo(171, t + 15);
- c.lineTo(166, t + 20);
- c.lineTo(166, t + 10);
- c.close();
- c.moveTo(178, t + 15);
- c.lineTo(173, t + 20);
- c.lineTo(173, t + 10);
- c.close();
- c.fillAndStroke();
- // end
- c.begin();
- c.moveTo(203, t + 10);
- c.lineTo(203, t + 20);
- c.lineTo(205, t + 20);
- c.lineTo(205, t + 10);
- c.close();
- c.moveTo(201, t + 15);
- c.lineTo(196, t + 20);
- c.lineTo(196, t + 10);
- c.close();
- c.fillAndStroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupPlaybackControls.prototype.cst.SHAPE_PLAYBACK_CONTROLS] = mxShapeMockupPlaybackControls;
- //**********************************************************************************************************************************************************
- //Progress Bar
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupProgressBar(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.barPos = 20;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeMockupProgressBar, mxShape);
- mxShapeMockupProgressBar.prototype.cst = {
- SHAPE_PROGRESS_BAR : 'mxgraph.mockup.misc.progressBar',
- BAR_POS : 'barPos',
- FILL_COLOR2 : 'fillColor2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupProgressBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, w, h);
- c.setShadow(false);
- this.foreground(c, w, h);
- };
- mxShapeMockupProgressBar.prototype.background = function(c, w, h)
- {
- c.roundrect(0, h * 0.5 - 5, w, 10, 5, 5);
- c.fillAndStroke();
- };
- mxShapeMockupProgressBar.prototype.foreground = function(c, w, h)
- {
- var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupProgressBar.prototype.cst.FILL_COLOR2, '#ddeeff');
- var barPos = mxUtils.getValue(this.style, mxShapeMockupProgressBar.prototype.cst.BAR_POS, '80');
- barPos = Math.min(barPos, 100);
- barPos = Math.max(barPos, 0);
- var deadzone = 0;
- var virRange = w - 2 * deadzone;
- var truePos = deadzone + virRange * barPos / 100;
- c.setFillColor(fillColor2);
- c.roundrect(0, h * 0.5 - 5, truePos, 10, 5, 5);
- c.fillAndStroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupProgressBar.prototype.cst.SHAPE_PROGRESS_BAR] = mxShapeMockupProgressBar;
- Graph.handleFactory[mxShapeMockupProgressBar.prototype.cst.SHAPE_PROGRESS_BAR] = function(state)
- {
- var handles = [Graph.createHandle(state, ['barPos'], function(bounds)
- {
- var barPos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'barPos', this.barPos))));
- return new mxPoint(bounds.x + barPos * bounds.width / 100, bounds.y + bounds.height * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['barPos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Shopping Cart
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupShoppingCart(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(mxShapeMockupShoppingCart, mxShape);
- mxShapeMockupShoppingCart.prototype.cst = {
- SHAPE_SHOPPING_CART : 'mxgraph.mockup.misc.shoppingCart'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupShoppingCart.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
- c.translate(x, y);
- c.setStrokeWidth(3);
- c.begin();
- c.moveTo(w * 0.975, h * 0.025);
- c.lineTo(w * 0.82, h * 0.055);
- c.lineTo(w * 0.59, h * 0.66);
- c.lineTo(w * 0.7, h * 0.765);
- c.arcTo(w * 0.06, h * 0.06, 0, 0, 1, w * 0.665, h * 0.86);
- c.lineTo(w * 0.05, h * 0.86);
- c.moveTo(w * 0.74, h * 0.26);
- c.lineTo(w * 0.03, h * 0.28);
- c.lineTo(w * 0.065, h * 0.61);
- c.lineTo(w * 0.59, h * 0.66);
- c.stroke();
- c.setStrokeWidth(1);
- c.begin();
- c.moveTo(w * 0.15, h * 0.28);
- c.lineTo(w * 0.15, h * 0.62);
- c.moveTo(w * 0.265, h * 0.275);
- c.lineTo(w * 0.265, h * 0.63);
- c.moveTo(w * 0.38, h * 0.27);
- c.lineTo(w * 0.38, h * 0.64);
- c.moveTo(w * 0.495, h * 0.265);
- c.lineTo(w * 0.495, h * 0.65);
- c.moveTo(w * 0.61, h * 0.265);
- c.lineTo(w * 0.61, h * 0.61);
- c.stroke();
- c.begin();
- c.moveTo(w * 0.69, h * 0.405);
- c.lineTo(w * 0.045, h * 0.405);
- c.moveTo(w * 0.645, h * 0.52);
- c.lineTo(w * 0.055, h * 0.52);
- c.stroke();
- c.setFillColor(strokeColor);
- c.ellipse(w * 0.075, h * 0.89, w * 0.1, h * 0.1);
- c.fillAndStroke();
- c.ellipse(w * 0.62, h * 0.89, w * 0.1, h * 0.1);
- c.fillAndStroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupShoppingCart.prototype.cst.SHAPE_SHOPPING_CART] = mxShapeMockupShoppingCart;
- //**********************************************************************************************************************************************************
- //Rating
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupRating(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(mxShapeMockupRating, mxShape);
- mxShapeMockupRating.prototype.cst = {
- SHAPE_RATING : 'mxgraph.mockup.misc.rating',
- RATING_STYLE : 'ratingStyle',
- RATING_SCALE : 'ratingScale',
- RATING_HEART : 'heart',
- RATING_STAR : 'star',
- EMPTY_FILL_COLOR : 'emptyFillColor',
- GRADE : 'grade'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupRating.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var ratingStyle = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.RATING_STYLE, mxShapeMockupRating.prototype.cst.RATING_STAR);
- var grade = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.GRADE, '5');
- var ratingScale = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.RATING_SCALE, '10');
- c.translate(x, y);
- if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_STAR)
- {
- for (var i = 0; i < grade; i++)
- {
- c.begin();
- c.moveTo(i * h * 1.5, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.364 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.475 * h, 0);
- c.lineTo(i * h * 1.5 + 0.586 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.95 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.66 * h, 0.551 * h);
- c.lineTo(i * h * 1.5 + 0.775 * h, 0.9 * h);
- c.lineTo(i * h * 1.5 + 0.475 * h, 0.684 * h);
- c.lineTo(i * h * 1.5 + 0.175 * h, 0.9 * h);
- c.lineTo(i * h * 1.5 + 0.29 * h, 0.551 * h);
- c.close();
- c.fillAndStroke();
- }
- }
- else if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_HEART)
- {
- for (var i = 0; i < grade; i++)
- {
- c.begin();
- c.moveTo(i * h * 1.5 + h * 0.519, h * 0.947);
- c.curveTo(i * h * 1.5 + h * 0.558, h * 0.908, i * h * 1.5 + h * 0.778, h * 0.682, i * h * 1.5 + h * 0.916, h * 0.54);
- c.curveTo(i * h * 1.5 + h * 1.039, h * 0.414, i * h * 1.5 + h * 1.036, h * 0.229, i * h * 1.5 + h * 0.924, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.812, 0, i * h * 1.5 + h * 0.631, 0, i * h * 1.5 + h * 0.519, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.408, 0, i * h * 1.5 + h * 0.227, 0, i * h * 1.5 + h * 0.115, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.03, h * 0.229, i * h * 1.5, h * 0.414, i * h * 1.5 + h * 0.123, h * 0.54);
- c.close();
- c.fillAndStroke();
- }
- }
- var emptyFillColor = mxUtils.getValue(this.style, mxShapeMockupRating.prototype.cst.EMPTY_FILL_COLOR, '#ffffff');
- c.setFillColor(emptyFillColor);
- if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_STAR)
- {
- for (var i = grade; i < ratingScale; i++)
- {
- c.begin();
- c.moveTo(i * h * 1.5, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.364 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.475 * h, 0);
- c.lineTo(i * h * 1.5 + 0.586 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.95 * h, 0.33 * h);
- c.lineTo(i * h * 1.5 + 0.66 * h, 0.551 * h);
- c.lineTo(i * h * 1.5 + 0.775 * h, 0.9 * h);
- c.lineTo(i * h * 1.5 + 0.475 * h, 0.684 * h);
- c.lineTo(i * h * 1.5 + 0.175 * h, 0.9 * h);
- c.lineTo(i * h * 1.5 + 0.29 * h, 0.551 * h);
- c.close();
- c.fillAndStroke();
- }
- }
- else if (ratingStyle === mxShapeMockupRating.prototype.cst.RATING_HEART)
- {
- for (var i = grade; i < ratingScale; i++)
- {
- c.begin();
- c.moveTo(i * h * 1.5 + h * 0.519, h * 0.947);
- c.curveTo(i * h * 1.5 + h * 0.558, h * 0.908, i * h * 1.5 + h * 0.778, h * 0.682, i * h * 1.5 + h * 0.916, h * 0.54);
- c.curveTo(i * h * 1.5 + h * 1.039, h * 0.414, i * h * 1.5 + h * 1.036, h * 0.229, i * h * 1.5 + h * 0.924, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.812, 0, i * h * 1.5 + h * 0.631, 0, i * h * 1.5 + h * 0.519, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.408, 0, i * h * 1.5 + h * 0.227, 0, i * h * 1.5 + h * 0.115, h * 0.115);
- c.curveTo(i * h * 1.5 + h * 0.03, h * 0.229, i * h * 1.5, h * 0.414, i * h * 1.5 + h * 0.123, h * 0.54);
- c.close();
- c.fillAndStroke();
- }
- }
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupRating.prototype.cst.SHAPE_RATING] = mxShapeMockupRating;
- //**********************************************************************************************************************************************************
- //Mail
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupMail(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(mxShapeMockupMail, mxShape);
- mxShapeMockupMail.prototype.cst = {
- SHAPE_MAIL : 'mxgraph.mockup.misc.mail2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupMail.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- c.setShadow(false);
- c.begin();
- c.moveTo(0, 0);
- c.lineTo(w * 0.5, h * 0.5);
- c.lineTo(w, 0);
- c.stroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupMail.prototype.cst.SHAPE_MAIL] = mxShapeMockupMail;
- //**********************************************************************************************************************************************************
- //Volume Slider
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupVolumeSlider(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- this.fill = fill;
- this.stroke = stroke;
- this.strokewidth = (strokewidth != null) ? strokewidth : 1;
- this.barPos = 80;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeMockupVolumeSlider, mxShape);
- mxShapeMockupVolumeSlider.prototype.cst = {
- SHAPE_VOLUME_SLIDER : 'mxgraph.mockup.misc.volumeSlider',
- BAR_POS : 'barPos',
- FILL_COLOR2 : 'fillColor2'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupVolumeSlider.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var barPos = mxUtils.getValue(this.style, mxShapeMockupVolumeSlider.prototype.cst.BAR_POS, '80');
- var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupVolumeSlider.prototype.cst.FILL_COLOR2, '#ddeeff');
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- //only the progress bar handle needs to be drawn
- barPos = Math.min(barPos, 100);
- barPos = Math.max(barPos, 0);
- var controlBarHeight = 25;
- var h = Math.max(h, controlBarHeight);
- var w = Math.max(w, 3.5 * controlBarHeight);
- var speakerStartX = w - controlBarHeight;
- var speakerStartY = (h - controlBarHeight) * 0.5;
- c.begin();
- c.moveTo(speakerStartX + controlBarHeight * 0.05, speakerStartY + controlBarHeight * 0.35);
- c.lineTo(speakerStartX + controlBarHeight * 0.15, speakerStartY + controlBarHeight * 0.35);
- c.lineTo(speakerStartX + controlBarHeight * 0.3, speakerStartY + controlBarHeight * 0.2);
- c.lineTo(speakerStartX + controlBarHeight * 0.3, speakerStartY + controlBarHeight * 0.8);
- c.lineTo(speakerStartX + controlBarHeight * 0.15, speakerStartY + controlBarHeight * 0.65);
- c.lineTo(speakerStartX + controlBarHeight * 0.05, speakerStartY + controlBarHeight * 0.65);
- c.close();
- c.fill();
- //draw the handle based on barPos
- var barMin = 0;
- var barMax = w - controlBarHeight * 1.3;
- var videoBarStartY = (h - controlBarHeight) * 0.5;
- var barRange = barMax - barMin;
- var barPos = barRange * barPos / 100;
- var barEnd = barMin + barPos;
- var soundStartX = w - controlBarHeight;
- var soundStartY = (h - controlBarHeight) * 0.5;
- c.begin();
- c.moveTo(soundStartX + controlBarHeight * 0.4, soundStartY + controlBarHeight * 0.35);
- c.arcTo(controlBarHeight * 0.2, controlBarHeight * 0.3, 0, 0, 1, soundStartX + controlBarHeight * 0.4, soundStartY + controlBarHeight * 0.65);
- c.moveTo(soundStartX + controlBarHeight * 0.425, soundStartY + controlBarHeight * 0.25);
- c.arcTo(controlBarHeight * 0.225, controlBarHeight * 0.35, 0, 0, 1, soundStartX + controlBarHeight * 0.425, soundStartY + controlBarHeight * 0.75);
- c.moveTo(soundStartX + controlBarHeight * 0.5, soundStartY + controlBarHeight * 0.2);
- c.arcTo(controlBarHeight * 0.25, controlBarHeight * 0.4, 0, 0, 1, soundStartX + controlBarHeight * 0.5, soundStartY + controlBarHeight * 0.8);
- c.fillAndStroke();
- //now we draw the video progress bar
- var videoBarStartX = 0;
- var videoBarStartY = (h - controlBarHeight) * 0.5;
- var videoBarEndX = w - controlBarHeight * 1.3;
- c.roundrect(videoBarStartX, videoBarStartY + controlBarHeight * 0.35, videoBarEndX, controlBarHeight * 0.3, 5, 5);
- c.fill();
- c.setShadow(false);
- c.setFillColor(fillColor2);
- c.roundrect(barMin, videoBarStartY + controlBarHeight * 0.35, barEnd, controlBarHeight * 0.3, 5, 5);
- c.fill();
-
- c.ellipse(barEnd - controlBarHeight * 0.25, videoBarStartY + controlBarHeight * 0.25, controlBarHeight * 0.5, controlBarHeight * 0.5);
- c.fillAndStroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupVolumeSlider.prototype.cst.SHAPE_VOLUME_SLIDER] = mxShapeMockupVolumeSlider;
- Graph.handleFactory[mxShapeMockupVolumeSlider.prototype.cst.SHAPE_VOLUME_SLIDER] = function(state)
- {
- var handles = [Graph.createHandle(state, ['barPos'], function(bounds)
- {
- var barPos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'barPos', this.barPos))));
- return new mxPoint(bounds.x + barPos * (bounds.width - 32.5) / 100, bounds.y + bounds.height * 0.5);
- }, function(bounds, pt)
- {
- this.state.style['barPos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Edit Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupEdit(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(mxShapeMockupEdit, mxShape);
- mxShapeMockupEdit.prototype.cst = {
- SHAPE_EDIT : 'mxgraph.mockup.misc.editIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupEdit.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.11, h * 0.8);
- c.lineTo(w * 0.2, h * 0.89);
- c.lineTo(w * 0.05, h * 0.95);
- c.close();
- c.moveTo(w * 0.74, h * 0.16);
- c.lineTo(w * 0.84, h * 0.26);
- c.lineTo(w * 0.22, h * 0.88);
- c.lineTo(w * 0.12, h * 0.78);
- c.close();
- c.moveTo(w * 0.755, h * 0.145);
- c.lineTo(w * 0.82, h * 0.08);
- c.lineTo(w * 0.92, h * 0.18);
- c.lineTo(w * 0.855, h * 0.245);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupEdit.prototype.cst.SHAPE_EDIT] = mxShapeMockupEdit;
- //**********************************************************************************************************************************************************
- //Print Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupPrint(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(mxShapeMockupPrint, mxShape);
- mxShapeMockupPrint.prototype.cst = {
- SHAPE_PRINT : 'mxgraph.mockup.misc.printIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupPrint.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.15, h * 0.58);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.18, h * 0.55);
- c.lineTo(w * 0.82, h * 0.55);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.85, h * 0.58);
- c.lineTo(w * 0.85, h * 0.82);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.82, h * 0.85);
- c.lineTo(w * 0.18, h * 0.85);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.15, h * 0.82);
- c.close();
- c.moveTo(w * 0.7, h * 0.52);
- c.lineTo(w * 0.3, h * 0.52);
- c.lineTo(w * 0.3, h * 0.15);
- c.lineTo(w * 0.55, h * 0.15);
- c.lineTo(w * 0.55, h * 0.3);
- c.lineTo(w * 0.7, h * 0.3);
- c.close();
- c.moveTo(w * 0.57, h * 0.15);
- c.lineTo(w * 0.7, h * 0.28);
- c.lineTo(w * 0.57, h * 0.28);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupPrint.prototype.cst.SHAPE_PRINT] = mxShapeMockupPrint;
- //**********************************************************************************************************************************************************
- //Print Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupShare(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(mxShapeMockupShare, mxShape);
- mxShapeMockupShare.prototype.cst = {
- SHAPE_SHARE : 'mxgraph.mockup.misc.shareIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupShare.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.15, h * 0.18);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.18, h * 0.15);
- c.lineTo(w * 0.82, h * 0.15);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.85, h * 0.18);
- c.lineTo(w * 0.85, h * 0.82);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.82, h * 0.85);
- c.lineTo(w * 0.18, h * 0.85);
- c.arcTo(w * 0.03, h * 0.03, 0, 0, 1, w * 0.15, h * 0.82);
- c.close();
- c.fill();
- var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
- c.setFillColor(fillColor);
- c.begin();
- c.moveTo(w * 0.563, h * 0.34);
- c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.603, h * 0.42);
- c.lineTo(w * 0.44, h * 0.5);
- c.lineTo(w * 0.602, h * 0.582);
- c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.563, h * 0.653);
- c.lineTo(w * 0.403, h * 0.575);
- c.arcTo(w * 0.095, h * 0.095, 0, 1, 1, w * 0.4, h * 0.42);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupShare.prototype.cst.SHAPE_SHARE] = mxShapeMockupShare;
- //**********************************************************************************************************************************************************
- //Trashcan Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupTrashcan(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(mxShapeMockupTrashcan, mxShape);
- mxShapeMockupTrashcan.prototype.cst = {
- SHAPE_TRASHCAN : 'mxgraph.mockup.misc.trashcanIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupTrashcan.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.24, h * 0.24);
- c.arcTo(w * 0.04, h * 0.04, 0, 0, 1, w * 0.24, h * 0.16);
- c.lineTo(w * 0.4, h * 0.16);
- c.lineTo(w * 0.4, h * 0.12);
- c.lineTo(w * 0.6, h * 0.12);
- c.lineTo(w * 0.6, h * 0.16);
- c.lineTo(w * 0.76, h * 0.16);
- c.arcTo(w * 0.04, h * 0.04, 0, 0, 1, w * 0.76, h * 0.24);
- c.close();
- c.fill();
- c.roundrect(w * 0.26, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
- c.fill();
- c.roundrect(w * 0.44, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
- c.fill();
- c.roundrect(w * 0.62, h * 0.3, w * 0.1, h * 0.6, w * 0.06, h * 0.06);
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupTrashcan.prototype.cst.SHAPE_TRASHCAN] = mxShapeMockupTrashcan;
- //**********************************************************************************************************************************************************
- //Copyright Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupCopyright(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(mxShapeMockupCopyright, mxShape);
- mxShapeMockupCopyright.prototype.cst = {
- SHAPE_COPYRIGHT : 'mxgraph.mockup.misc.copyrightIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupCopyright.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.ellipse(0, 0, w, h);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.713, h * 0.288);
- c.arcTo(w * 0.3, h * 0.3, 0, 1, 0, w * 0.713, h * 0.712);
- c.lineTo(w * 0.784, h * 0.783);
- c.arcTo(w * 0.4, h * 0.4, 0, 1, 1, w * 0.784, h * 0.217);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupCopyright.prototype.cst.SHAPE_COPYRIGHT] = mxShapeMockupCopyright;
- //**********************************************************************************************************************************************************
- //Registered Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupRegistered(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(mxShapeMockupRegistered, mxShape);
- mxShapeMockupRegistered.prototype.cst = {
- SHAPE_REGISTERED : 'mxgraph.mockup.misc.registeredIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupRegistered.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.ellipse(0, 0, w, h);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.29, h * 0.9);
- c.lineTo(w * 0.29, h * 0.09);
- c.lineTo(w * 0.5, h * 0.09);
- c.arcTo(w * 0.2195, h * 0.2195, 0, 0, 1, w * 0.545, h * 0.525);
- c.lineTo(w * 0.738, h * 0.91);
- c.lineTo(w * 0.674, h * 0.91);
- c.lineTo(w * 0.4825, h * 0.53);
- c.lineTo(w * 0.35, h * 0.53);
- c.lineTo(w * 0.35, h * 0.9);
- c.close();
- c.moveTo(w * 0.35, h * 0.47);
- c.lineTo(w * 0.5, h * 0.47);
- c.arcTo(w * 0.15, h * 0.15, 0, 0, 0, w * 0.5, h * 0.15);
- c.lineTo(w * 0.35, h * 0.15);
- c.close();
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupRegistered.prototype.cst.SHAPE_REGISTERED] = mxShapeMockupRegistered;
- //**********************************************************************************************************************************************************
- //Volume Icon
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupVolume(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(mxShapeMockupVolume, mxShape);
- mxShapeMockupVolume.prototype.cst = {
- SHAPE_VOLUME : 'mxgraph.mockup.misc.volumeIcon'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupVolume.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#999999');
- c.translate(x, y);
- c.roundrect(0, 0, w, h, w * 0.05, h * 0.05);
- c.fillAndStroke();
- c.setShadow(false);
- c.setFillColor(strokeColor);
- c.begin();
- c.moveTo(w * 0.1, h * 0.3);
- c.lineTo(w * 0.3, h * 0.3);
- c.lineTo(w * 0.5, h * 0.15);
- c.lineTo(w * 0.5, h * 0.85);
- c.lineTo(w * 0.3, h * 0.7);
- c.lineTo(w * 0.1, h * 0.7);
- c.close();
- c.fill();
-
- c.begin();
- c.moveTo(w * 0.6, h * 0.4);
- c.arcTo(w * 0.2, h * 0.2, 0, 0, 1, w * 0.6, h * 0.6);
- c.moveTo(w * 0.7, h * 0.3);
- c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, w * 0.7, h * 0.7);
-
- c.moveTo(w * 0.8, h * 0.2);
- c.arcTo(w * 0.4, h * 0.4, 0, 0, 1, w * 0.8, h * 0.8);
- c.stroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupVolume.prototype.cst.SHAPE_VOLUME] = mxShapeMockupVolume;
- //**********************************************************************************************************************************************************
- //Ruler
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupRuler(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(mxShapeMockupRuler, mxShape);
- mxShapeMockupRuler.prototype.cst = {
- SHAPE_RULER : 'mxgraph.mockup.misc.ruler',
- ORIENTATION : 'rulerOrient',
- UNIT_SIZE : 'unitSize',
- FACE_UP : 'up',
- FACE_DOWN : 'down'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupRuler.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, w, h);
- c.setShadow(false);
- this.foreground(c, w, h);
- };
- mxShapeMockupRuler.prototype.background = function(c, w, h)
- {
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- };
- mxShapeMockupRuler.prototype.foreground = function(c, w, h)
- {
- var facing = mxUtils.getValue(this.style, mxShapeMockupRuler.prototype.cst.ORIENTATION, mxShapeMockupRuler.prototype.cst.FACE_DOWN);
- var unitSize = mxUtils.getValue(this.style, mxShapeMockupRuler.prototype.cst.UNIT_SIZE, '10');
-
- unitSize = Math.max(unitSize, 1);
-
- var currX = unitSize;
- var i = 1;
- if (facing === mxShapeMockupRuler.prototype.cst.FACE_DOWN)
- {
- c.begin();
-
- while (currX < w)
- {
- var remainder = i % 10;
- if (remainder === 0)
- {
- c.moveTo(currX, h * 0.5);
- c.lineTo(currX, h);
- }
- else if ( remainder === 5)
- {
- c.moveTo(currX, h * 0.7);
- c.lineTo(currX, h);
- }
- else
- {
- c.moveTo(currX, h * 0.8);
- c.lineTo(currX, h);
- }
- currX = currX + unitSize;
- i = i + 1;
- }
-
- c.stroke();
- }
- else if (facing === mxShapeMockupRuler.prototype.cst.FACE_UP)
- {
- c.begin();
-
- while (currX < w)
- {
- var remainder = i % 10;
- if (remainder === 0)
- {
- c.moveTo(currX, h * 0.5);
- c.lineTo(currX, 0);
- }
- else if ( remainder === 5)
- {
- c.moveTo(currX, h * 0.3);
- c.lineTo(currX, 0);
- }
- else
- {
- c.moveTo(currX, h * 0.2);
- c.lineTo(currX, 0);
- }
- currX = currX + unitSize;
- i = i + 1;
- }
-
- c.stroke();
- }
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupRuler.prototype.cst.SHAPE_RULER] = mxShapeMockupRuler;
- //**********************************************************************************************************************************************************
- //Advanced Ruler
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupRuler2(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(mxShapeMockupRuler2, mxShape);
- mxShapeMockupRuler2.prototype.cst = {
- SHAPE_RULER : 'mxgraph.mockup.misc.ruler2',
- ORIENTATION : 'rulerOrient',
- UNIT_SIZE : 'unitSize',
- FACE_UP : 'up',
- FACE_DOWN : 'down'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupRuler2.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, w, h);
- c.setShadow(false);
- this.foreground(c, w, h);
- };
- mxShapeMockupRuler2.prototype.background = function(c, w, h)
- {
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- };
- mxShapeMockupRuler2.prototype.foreground = function(c, w, h)
- {
- var facing = mxUtils.getValue(this.style, mxShapeMockupRuler2.prototype.cst.ORIENTATION, mxShapeMockupRuler2.prototype.cst.FACE_DOWN);
- var fontColor = mxUtils.getValue(this.style, mxConstants.STYLE_FONTCOLOR, '#000000');
- var dx = mxUtils.getValue(this.style, 'dx', '100');
- var unitSize = dx / 10;
-
- unitSize = Math.max(unitSize, 1);
-
- c.setFontColor(fontColor);
-
- var currX = unitSize;
- var i = 1;
- if (facing === mxShapeMockupRuler2.prototype.cst.FACE_DOWN)
- {
- c.begin();
-
- while (currX < w)
- {
- var remainder = i % 10;
- if (remainder === 0)
- {
- c.moveTo(currX, h - 10);
- c.lineTo(currX, h);
-
- var unit = this.state.view.graph.getLabel(this.state.cell);
-
- if (!isNaN(unit))
- {
- c.stroke();
-
- var num = i * Math.round(100 * unit) / 1000;
-
- if (i != 10 && num != 0)
- {
- c.text(currX, (h - 10) * 0.5, 0, 0, num.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- }
- c.begin();
- }
- }
- else if ( remainder === 5)
- {
- c.moveTo(currX, h - 6);
- c.lineTo(currX, h);
- }
- else
- {
- c.moveTo(currX, h - 4);
- c.lineTo(currX, h);
- }
- currX = currX + unitSize;
- i = i + 1;
- }
-
- c.stroke();
- }
- else if (facing === mxShapeMockupRuler2.prototype.cst.FACE_UP)
- {
- c.begin();
-
- while (currX < w)
- {
- var remainder = i % 10;
- if (remainder === 0)
- {
- c.moveTo(currX, 10);
- c.lineTo(currX, 0);
- var unit = this.state.view.graph.getLabel(this.state.cell);
-
- if (!isNaN(unit))
- {
- c.stroke();
-
- var num = i * Math.round(100 * unit) / 1000;
-
- if (i != 10 && num != 0)
- {
- c.text(currX, (h + 10) * 0.5, 0, 0, num.toString(), mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- }
- c.begin();
- }
- }
- else if ( remainder === 5)
- {
- c.moveTo(currX, 6);
- c.lineTo(currX, 0);
- }
- else
- {
- c.moveTo(currX, 4);
- c.lineTo(currX, 0);
- }
- currX = currX + unitSize;
- i = i + 1;
- }
-
- c.stroke();
- }
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupRuler2.prototype.cst.SHAPE_RULER] = mxShapeMockupRuler2;
- Graph.handleFactory[mxShapeMockupRuler2.prototype.cst.SHAPE_RULER] = function(state)
- {
- var handles = [Graph.createHandle(state, ['dx', 'spacingLeft', 'align', 'varticalAlign', 'spacingBottom', 'spacingTop', 'spacingRight', 'spacing'], function(bounds)
- {
- var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
- return new mxPoint(bounds.x + dx, bounds.y + bounds.height - 10);
- }, function(bounds, pt)
- {
- this.state.style['dx'] = Math.round(1000 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 1000;
- this.state.style['spacingLeft'] = Math.round(1000 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 1000 - 4;
- this.state.style['align'] = 'left';
- this.state.style['verticalAlign'] = 'middle';
-
- var facing = mxUtils.getValue(this.state.style, 'rulerOrient', '1');
-
- if (facing == 'down')
- {
- this.state.style['spacingBottom'] = 10;
- this.state.style['spacingTop'] = 0;
- console.log('down');
- }
- else
- {
- this.state.style['spacingBottom'] = 0;
- this.state.style['spacingTop'] = 10;
- console.log('up');
- }
-
- this.state.style['spacingRight'] = 0;
- this.state.style['spacing'] = 0;
- })];
- return handles;
- }
- //**********************************************************************************************************************************************************
- //Revision Table
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupRevisionTable(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(mxShapeMockupRevisionTable, mxShape);
- mxShapeMockupRevisionTable.prototype.cst = {
- SHAPE_REVISION_TABLE : 'mxgraph.mockup.misc.revisionTable',
- MAIN_TEXT : 'mainText',
- TEXT_COLOR : 'textColor',
- TEXT_SIZE : 'textSize'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupRevisionTable.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- this.background(c, w, h);
- c.setShadow(false);
- this.foreground(c, w, h);
- };
- mxShapeMockupRevisionTable.prototype.background = function(c, w, h)
- {
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- };
- mxShapeMockupRevisionTable.prototype.foreground = function(c, w, h)
- {
- var mainText = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.MAIN_TEXT, '').toString().split(',');
- var textColor = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.TEXT_COLOR, '#999999');
- var textSize = mxUtils.getValue(this.style, mxShapeMockupRevisionTable.prototype.cst.TEXT_SIZE, '17');
-
- c.begin();
- c.moveTo(0, h * 0.33);
- c.lineTo(w, h * 0.33);
- c.moveTo(0, h * 0.67);
- c.lineTo(w, h * 0.67);
- c.moveTo(w * 0.125, h * 0.33);
- c.lineTo(w * 0.125, h);
- c.moveTo(w * 0.5, h * 0.33);
- c.lineTo(w * 0.5, h);
- c.stroke();
-
- c.setFontSize(textSize);
- c.setFontColor(textColor);
-
- c.text(w * 0.5, h * 0.165, 0, 0, mainText[0], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.0625, h * 0.5, 0, 0, mainText[1], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.3125, h * 0.5, 0, 0, mainText[2], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.75, h * 0.5, 0, 0, mainText[3], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.0625, h * 0.835, 0, 0, mainText[4], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.3125, h * 0.835, 0, 0, mainText[5], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(w * 0.75, h * 0.835, 0, 0, mainText[6], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupRevisionTable.prototype.cst.SHAPE_REVISION_TABLE] = mxShapeMockupRevisionTable;
- //**********************************************************************************************************************************************************
- //Status Bar
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupStatusBar(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(mxShapeMockupStatusBar, mxShape);
- mxShapeMockupStatusBar.prototype.cst = {
- SHAPE_STATUS_BAR : 'mxgraph.mockup.misc.statusBar',
- MAIN_TEXT : 'mainText',
- FILL_COLOR2 : 'fillColor2',
- STROKE_COLOR2 : 'strokeColor2',
- TEXT_COLOR : 'textColor',
- TEXT_SIZE : 'textSize'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupStatusBar.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- w = Math.max(w, 105);
-
- this.background(c, w, h);
- c.setShadow(false);
- this.foreground(c, w, h);
- };
- mxShapeMockupStatusBar.prototype.background = function(c, w, h)
- {
- c.rect(0, h * 0.5 - 15, w, 30);
- c.fillAndStroke();
- };
- mxShapeMockupStatusBar.prototype.foreground = function(c, w, h)
- {
- var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.FILL_COLOR2, '#ddeeff');
- var strokeColor2 = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.STROKE_COLOR2, '#008cff');
- var mainText = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.MAIN_TEXT, '').toString().split(',');
- var textColor = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.TEXT_COLOR, '#999999');
- var textSize = mxUtils.getValue(this.style, mxShapeMockupStatusBar.prototype.cst.TEXT_SIZE, '17');
-
- c.setFillColor(fillColor2);
- c.roundrect(5, h * 0.5 - 10, (w - 75) * 0.46, 20, 5, 5);
- c.fill();
- c.roundrect(10 + (w - 75) * 0.46, h * 0.5 - 10, (w - 75) * 0.23, 20, 5, 5);
- c.fill();
- c.roundrect(15 + (w - 75) * 0.69, h * 0.5 - 10, (w - 75) * 0.276, 20, 5, 5);
- c.fill();
-
- c.setFontSize(textSize);
- c.setFontColor(textColor);
- c.text(10, h * 0.5, 0, 0, mainText[0], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(10 + (w - 75) * 0.575, h * 0.5, 0, 0, mainText[1], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
- c.text(15 + (w - 75) * 0.828, h * 0.5, 0, 0, mainText[2], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
-
- c.setStrokeColor(strokeColor2);
- c.ellipse(w - 25, h * 0.5 - 10, 20, 20);
- c.stroke();
- c.begin();
- c.moveTo(w - 55, h * 0.5 + 10);
- c.lineTo(w - 35, h * 0.5 + 10);
- c.stroke();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupStatusBar.prototype.cst.SHAPE_STATUS_BAR] = mxShapeMockupStatusBar;
- //**********************************************************************************************************************************************************
- //Pin
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupPin(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(mxShapeMockupPin, mxShape);
- mxShapeMockupPin.prototype.cst = {
- SHAPE_PIN : 'mxgraph.mockup.misc.pin',
- FILL_COLOR2 : 'fillColor2',
- FILL_COLOR3 : 'fillColor3'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupPin.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- var fillColor2 = mxUtils.getValue(this.style, mxShapeMockupPin.prototype.cst.FILL_COLOR2, '#000000');
- var fillColor3 = mxUtils.getValue(this.style, mxShapeMockupPin.prototype.cst.FILL_COLOR3, '#000000');
- var strokeColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#000000');
- c.setShadow(false);
- c.translate(x, y);
- c.setStrokeWidth(3);
- c.setStrokeColor('#666666');
- c.begin();
- c.moveTo(w * 0.5, h * 0.4);
- c.lineTo(w * 0.5, h);
- c.stroke();
- c.setStrokeWidth(2);
- c.setStrokeColor(strokeColor);
- c.setGradient(fillColor2, fillColor3, 0, 0, w, h * 0.4, mxConstants.DIRECTION_SOUTH, 1, 1);
- c.setAlpha(0.9);
- c.ellipse(0, 0, w, h * 0.4);
- c.fillAndStroke();
- c.setFillColor('#ffffff');
- c.setAlpha(0.5);
- c.ellipse(w * 0.2, h * 0.08, w * 0.3, h * 0.12);
- c.fill();
- };
- mxCellRenderer.prototype.defaultShapes[mxShapeMockupPin.prototype.cst.SHAPE_PIN] = mxShapeMockupPin;
- //**********************************************************************************************************************************************************
- //Rounded rectangle (adjustable rounding)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupMiscRRect(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(mxShapeMockupMiscRRect, mxShape);
- mxShapeMockupMiscRRect.prototype.cst = {
- RRECT : 'mxgraph.mockup.misc.rrect',
- R_SIZE : 'rSize'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupMiscRRect.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- c.translate(x, y);
- var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupMiscRRect.prototype.cst.R_SIZE, '10'));
- c.roundrect(0, 0, w, h, rSize);
- c.fillAndStroke();
- };
- mxCellRenderer.registerShape(mxShapeMockupMiscRRect.prototype.cst.RRECT, mxShapeMockupMiscRRect);
- //**********************************************************************************************************************************************************
- //Anchor (a dummy shape without visuals used for anchoring)
- //**********************************************************************************************************************************************************
- /**
- * Extends mxShape.
- */
- function mxShapeMockupMiscAnchor(bounds, fill, stroke, strokewidth)
- {
- mxShape.call(this);
- this.bounds = bounds;
- };
- /**
- * Extends mxShape.
- */
- mxUtils.extend(mxShapeMockupMiscAnchor, mxShape);
- mxShapeMockupMiscAnchor.prototype.cst = {
- ANCHOR : 'mxgraph.mockup.misc.anchor'
- };
- /**
- * Function: paintVertexShape
- *
- * Paints the vertex shape.
- */
- mxShapeMockupMiscAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
- {
- };
- mxCellRenderer.registerShape(mxShapeMockupMiscAnchor.prototype.cst.ANCHOR, mxShapeMockupMiscAnchor);
|