From 52f2b7ece45db55ee49dad5e732b558751f71b26 Mon Sep 17 00:00:00 2001 From: AlexDM0 Date: Tue, 13 Jan 2015 11:26:01 +0100 Subject: [PATCH] possible fix for dashed line issue --- dist/vis.js | 26 ++++++++------------------ lib/network/Edge.js | 24 +++++++----------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/dist/vis.js b/dist/vis.js index f477232c..480edc09 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 3.8.1-SNAPSHOT - * @date 2015-01-12 + * @date 2015-01-13 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -28191,7 +28191,8 @@ return /******/ (function(modules) { // webpackBootstrap var via = null; // only firefox and chrome support this method, else we use the legacy one. - if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { + if (ctx.setLineDash !== undefined) { + ctx.save(); // configure the dash pattern var pattern = [0]; if (this.options.dash.length !== undefined && this.options.dash.gap !== undefined) { @@ -28202,27 +28203,16 @@ return /******/ (function(modules) { // webpackBootstrap } // set dash settings for chrome or firefox - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash(pattern); - ctx.lineDashOffset = 0; - - } else { //Firefox - ctx.mozDash = pattern; - ctx.mozDashOffset = 0; - } + ctx.setLineDash(pattern); + ctx.lineDashOffset = 0; // draw the line via = this._line(ctx); // restore the dash settings. - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash([0]); - ctx.lineDashOffset = 0; - - } else { //Firefox - ctx.mozDash = [0]; - ctx.mozDashOffset = 0; - } + ctx.setLineDash([0]); + ctx.lineDashOffset = 0; + ctx.restore(); } else { // unsupporting smooth lines // draw dashed line diff --git a/lib/network/Edge.js b/lib/network/Edge.js index 4845a5be..9757cc54 100644 --- a/lib/network/Edge.js +++ b/lib/network/Edge.js @@ -609,7 +609,8 @@ Edge.prototype._drawDashLine = function(ctx) { var via = null; // only firefox and chrome support this method, else we use the legacy one. - if (ctx.mozDash !== undefined || ctx.setLineDash !== undefined) { + if (ctx.setLineDash !== undefined) { + ctx.save(); // configure the dash pattern var pattern = [0]; if (this.options.dash.length !== undefined && this.options.dash.gap !== undefined) { @@ -620,27 +621,16 @@ Edge.prototype._drawDashLine = function(ctx) { } // set dash settings for chrome or firefox - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash(pattern); - ctx.lineDashOffset = 0; - - } else { //Firefox - ctx.mozDash = pattern; - ctx.mozDashOffset = 0; - } + ctx.setLineDash(pattern); + ctx.lineDashOffset = 0; // draw the line via = this._line(ctx); // restore the dash settings. - if (typeof ctx.setLineDash !== 'undefined') { //Chrome - ctx.setLineDash([0]); - ctx.lineDashOffset = 0; - - } else { //Firefox - ctx.mozDash = [0]; - ctx.mozDashOffset = 0; - } + ctx.setLineDash([0]); + ctx.lineDashOffset = 0; + ctx.restore(); } else { // unsupporting smooth lines // draw dashed line