| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680 |
- /**
- * $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'
- };
- mxShapeMockupPlaybackControls.prototype.customProperties = [
- {name: 'fillColor2', dispName: 'Outline Color', type: 'color'},
- {name: 'fillColor3', dispName: 'Symbol Color', type: 'color'},
- {name: 'strokeColor2', dispName: 'Outline Stroke Color', type: 'color'},
- {name: 'strokeColor3', dispName: 'Symbol Stroke Color', type: 'color'}
- ];
- /**
- * 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.registerShape(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'
- };
- mxShapeMockupProgressBar.prototype.customProperties = [
- {name: 'fillColor2', dispName: 'Outline Color', type: 'color'},
- {name: 'barPos', dispName: 'Handle Position', type: 'float', min:0, defVal:80}
- ];
- /**
- * 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.registerShape(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.registerShape(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'
- };
- mxShapeMockupRating.prototype.customProperties = [
- {name: 'ratingStyle', dispName: 'Style', type: 'enum',
- enumList: [{val: 'heart', dispName: 'Heart'}, {val: 'star', dispName: 'Star'}]
- },
- {name: 'ratingScale', dispName: 'Max. Rating', type: 'int'},
- {name: 'grade', dispName: 'Current Rating', type: 'int'},
- {name: 'emptyFillColor', dispName: 'Fill2 Color', type: 'color'}
- ];
- /**
- * 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.registerShape(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.registerShape(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'
- };
- mxShapeMockupVolumeSlider.prototype.customProperties = [
- {name: 'fillColor2', dispName: 'Fill2 Color', type: 'color'},
- {name: 'barPos', dispName: 'Handle Position', type: 'float'}
- ];
- /**
- * 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.registerShape(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.registerShape(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.registerShape(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.registerShape(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.registerShape(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.registerShape(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.registerShape(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.registerShape(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.registerShape(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 : 'dx',
- FACE_UP : 'up',
- FACE_DOWN : 'down'
- };
- mxShapeMockupRuler2.prototype.customProperties = [
- {name: 'rulerOrient', dispName: 'Orientation', defVal:'up', type: 'enum',
- enumList: [{val: 'up', dispName: 'Up'}, {val: 'down', dispName: 'Down'}]
- },
- {name: 'dx', dispName: 'Unit Size', type: 'float', min:0, defVal:100}
- ];
- /**
- * 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, x, y, w, h);
- };
- mxShapeMockupRuler2.prototype.background = function(c, w, h)
- {
- c.rect(0, 0, w, h);
- c.fillAndStroke();
- };
- mxShapeMockupRuler2.prototype.foreground = function(c, x, y, 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;
- this.state.style['spacingLeft'] = Math.round(1000 * Math.max(0, Math.min(w, dx))) / 1000 - 4;
-
- 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.registerShape(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;
- }
- else
- {
- this.state.style['spacingBottom'] = 0;
- this.state.style['spacingTop'] = 10;
- }
-
- 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.registerShape(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.registerShape(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'
- };
- mxShapeMockupPin.prototype.customProperties = [
- {name: 'fillColor2', dispName: 'Fill2 Color', type: 'color'},
- {name: 'fillColor3', dispName: 'Fill3 Color', type: 'color'}
- ];
- /**
- * 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.registerShape(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'
- };
- mxShapeMockupMiscRRect.prototype.customProperties = [
- {name: 'rSize', dispName: 'Arc Size', type: 'float', min:0, defVal:10}
- ];
- /**
- * 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);
|