created colors values shared between javascript and sass

This commit is contained in:
Bachir Soussi Chiadmi
2018-01-08 17:26:13 +01:00
parent f117a95e65
commit 5a57d72f00
16 changed files with 265 additions and 120 deletions
@@ -11,6 +11,7 @@
/**
* depends on :
*
* physics.js : http://jonobr1.com/Physics/#
* EaselJS : https://createjs.com/docs/easeljs/modules/EaselJS.html
*
@@ -39,30 +40,9 @@
var _node_hover_id = -1;
var _$entrees_block = $('#block-edlpentreesblock');
var _$entrees_block_termlinks = $('a.term-link', _$entrees_block);
var _entrees_colors = {
"130":"rgb(75, 143, 126)",
"121":"rgb(134, 142, 36)",
"134":"rgb(43, 143, 47)",
"121":"rgb(58, 51, 182)",
"125":"rgb(44, 159, 87)",
"119":"rgb(196, 137, 120)",
"132":"rgb(82, 112, 187)",
"122":"rgb(251, 84, 211)",
"129":"rgb(224, 116, 131)",
"120":"rgb(101, 88, 69)",
"130":"rgb(126, 8, 104)",
"118":"rgb(14, 113, 33)",
"127":"rgb(218, 189, 66)",
"133":"rgb(3, 153, 187)",
"128":"rgb(57, 154, 28)",
"124":"rgb(112, 133, 64)",
"116":"rgb(25, 27, 255)",
"117":"rgb(39, 157, 132)",
"131":"rgb(82, 25, 171)",
"126":"rgb(212, 156, 182)",
"123":"rgb(73, 119, 21)"
};
// Colors depend on edlp_vars loaded by edlptheme
// console.log('Corpus : edlp_vars', edlp_vars);
// ____ _ __
// / _/___ (_) /______
@@ -253,12 +233,18 @@
Node.prototype.draw = function(){
_ctx.beginPath();
_ctx.lineWidth = this.hover ? this.g.l*2 : this.g.l;
_ctx.lineWidth = this.g.l*2;//this.hover ? this.g.l*2 : this.g.l;
var r,d;
for (var i = 0; i < this.entrees.length; i++) {
_ctx.strokeStyle = _entrees_colors[this.entrees[i]];
// _ctx.fillStyle = i == 0 ? _entrees_colors[this.entrees[i]] : "#fff";
// _ctx.strokeStyle = _entrees_colors[this.entrees[i]];
_ctx.fillStyle = i == 0 ? edlp_vars['e_col_'+this.entrees[i]] : "#fff";
_ctx.strokeStyle = edlp_vars['e_col_'+this.entrees[i]];
r = this.base_radius + (this.g.l+this.g.s)*i; // radius
d = r*2; // diametre
if (i == 0) {
_ctx.fillRect(this.x - r,this.y - r,d,d);
}
_ctx.strokeRect(this.x - r,this.y - r,d,d);
}
_ctx.closePath();
@@ -337,10 +323,10 @@
// / /___ | |/ / __/ / / / /_(__ )
// /_____/ |___/\___/_/ /_/\__/____/
function initEvents(){
_$container
_$canvas
.on('mousemove', function(event) {
event.preventDefault();
// console.log("onMouseMove", event);
console.log("onMouseMove");
_m_pos.x = event.originalEvent.clientX;
_m_pos.y = event.originalEvent.clientY;
// console.log("/ _ / - / _ /");
@@ -383,9 +369,9 @@
_nodes[i].onUpdate();
}
if(_node_hover_id != -1){
document.body.style.cursor = 'pointer';
_canvas.style.cursor = 'pointer';
}else{
document.body.style.cursor = 'auto';
_canvas.style.cursor = 'auto';
}
};
@@ -11,6 +11,7 @@
/**
* depends on :
*
* physics.js : http://jonobr1.com/Physics/#
* EaselJS : https://createjs.com/docs/easeljs/modules/EaselJS.html
*
@@ -39,30 +40,9 @@
var _node_hover_id = -1;
var _$entrees_block = $('#block-edlpentreesblock');
var _$entrees_block_termlinks = $('a.term-link', _$entrees_block);
var _entrees_colors = {
"130":"rgb(75, 143, 126)",
"121":"rgb(134, 142, 36)",
"134":"rgb(43, 143, 47)",
"121":"rgb(58, 51, 182)",
"125":"rgb(44, 159, 87)",
"119":"rgb(196, 137, 120)",
"132":"rgb(82, 112, 187)",
"122":"rgb(251, 84, 211)",
"129":"rgb(224, 116, 131)",
"120":"rgb(101, 88, 69)",
"130":"rgb(126, 8, 104)",
"118":"rgb(14, 113, 33)",
"127":"rgb(218, 189, 66)",
"133":"rgb(3, 153, 187)",
"128":"rgb(57, 154, 28)",
"124":"rgb(112, 133, 64)",
"116":"rgb(25, 27, 255)",
"117":"rgb(39, 157, 132)",
"131":"rgb(82, 25, 171)",
"126":"rgb(212, 156, 182)",
"123":"rgb(73, 119, 21)"
};
// Colors depend on edlp_vars loaded by edlptheme
// console.log('Corpus : edlp_vars', edlp_vars);
// ____ _ __
// / _/___ (_) /______
@@ -253,12 +233,18 @@
Node.prototype.draw = function(){
_ctx.beginPath();
_ctx.lineWidth = this.hover ? this.g.l*2 : this.g.l;
_ctx.lineWidth = this.g.l*2;//this.hover ? this.g.l*2 : this.g.l;
var r,d;
for (var i = 0; i < this.entrees.length; i++) {
_ctx.strokeStyle = _entrees_colors[this.entrees[i]];
// _ctx.fillStyle = i == 0 ? _entrees_colors[this.entrees[i]] : "#fff";
// _ctx.strokeStyle = _entrees_colors[this.entrees[i]];
_ctx.fillStyle = i == 0 ? edlp_vars['e_col_'+this.entrees[i]] : "#fff";
_ctx.strokeStyle = edlp_vars['e_col_'+this.entrees[i]];
r = this.base_radius + (this.g.l+this.g.s)*i; // radius
d = r*2; // diametre
if (i == 0) {
_ctx.fillRect(this.x - r,this.y - r,d,d);
}
_ctx.strokeRect(this.x - r,this.y - r,d,d);
}
_ctx.closePath();
@@ -337,10 +323,10 @@
// / /___ | |/ / __/ / / / /_(__ )
// /_____/ |___/\___/_/ /_/\__/____/
function initEvents(){
_$container
_$canvas
.on('mousemove', function(event) {
event.preventDefault();
// console.log("onMouseMove", event);
console.log("onMouseMove");
_m_pos.x = event.originalEvent.clientX;
_m_pos.y = event.originalEvent.clientY;
// console.log("/ _ / - / _ /");
@@ -383,9 +369,9 @@
_nodes[i].onUpdate();
}
if(_node_hover_id != -1){
document.body.style.cursor = 'pointer';
_canvas.style.cursor = 'pointer';
}else{
document.body.style.cursor = 'auto';
_canvas.style.cursor = 'auto';
}
};
@@ -11,6 +11,7 @@
"gulp-autoprefixer": "latest",
"gulp-cssmin": "latest",
"gulp-jsmin": "latest",
"gulp-json-to-sass": "0.0.4",
"gulp-rename": "latest",
"gulp-sass": "latest",
"gulp-strip-debug": "latest",