答案 0 :(得分:1)
对于您提供的数据,order by text
有效。但是,这可能不是您想要做的通用解决方案,除非节点的名称(如您的示例中所示)遵循非常设置的模式。
答案 1 :(得分:0)
按升序排序
window.drawIMG = function() {
console.log("Getting image");
var src = imgURLText;
var img = document.createElement("img");
img.src = src;
var canvas = document.createElement("canvas");
canvas.width = document.body.clientWidth;
canvas.height = document.body.clientHeight;
canvas.getContext('2d').drawImage(img, (canvas.width / 2) - (canvas.width / 2), 0, canvas.width, canvas.height);
console.log("Start draw");
for(x = 0; x < document.body.clientWidth; x = x + 10){
for(y = 0; y < document.body.clientHeight; y = y + 10){
color = canvas.getContext('2d').getImageData(x, y, 1, 1).data;
hexColor = rgb2hex(color);
mode.pickColor(hexColor);
// Start drawing a line
startLine(x,y);
// Insert point in line
linePoint(x,y);
console.log("Point: " + x + ", " + y);
// Stop drawing line
endLine();
// If this was successful, send to clients and clear array
if(mode.points.length>0){
mode.sendDrawData(mode.points);
console.log("points length: "+mode.points.length);
mode.points = [];
}
}
}
canvas.remove();
console.log("End draw");
};