|
|
@@ -6,22 +6,6 @@ app.controller('uploadCtrl', function ($scope, $http,video,notify) {
|
|
|
$scope.diapos = [];
|
|
|
$scope.profesores = [];
|
|
|
|
|
|
- var canvas = document.getElementById('c');
|
|
|
- var container = canvas.parentNode;
|
|
|
- var ctx = canvas.getContext('2d');
|
|
|
- var dpr = window.devicePixelRatio || 1;
|
|
|
- var img = new Image();
|
|
|
- var diapos = [];
|
|
|
-
|
|
|
- img.src="https://curso.especificosba.com.ar/diapo/EBA/1.png"; //Cargo la imagen inicial, a espera de informacion
|
|
|
- img.onload=function(){ //Cuando una imagen carga en mi obj imagen, quiero que se dibuje en canvas
|
|
|
- ctx.drawImage(img,0,0,canvas.width, canvas.height);
|
|
|
- }
|
|
|
- $scope.updateDiapos = function(d) {
|
|
|
- diapos = JSON.parse(d);
|
|
|
- parseMessage(diapos[0]);
|
|
|
- }
|
|
|
-
|
|
|
function getProf(){
|
|
|
$http.get("https://plataforma.especificosba.com.ar/back/getAllProfesores.php?auth_token=4b494d6c7ffc74d387d8cfdef8ca1691").then(
|
|
|
function(data){
|
|
|
@@ -31,49 +15,7 @@ app.controller('uploadCtrl', function ($scope, $http,video,notify) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- function respondCanvas(){
|
|
|
- canvas.setAttribute('width', container.offsetWidth);
|
|
|
- canvas.setAttribute('height', container.offsetWidth/4*3);
|
|
|
- }
|
|
|
-
|
|
|
getProf();
|
|
|
- respondCanvas();
|
|
|
-
|
|
|
- if (!String.prototype.format) {
|
|
|
- String.prototype.format = function() {
|
|
|
- var args = arguments;
|
|
|
- return this.replace(/{(\d+)}/g, function(match, number) {
|
|
|
- return ( typeof args[number] != 'undefined' ? args[number] : match );
|
|
|
- });
|
|
|
- };
|
|
|
- }
|
|
|
-
|
|
|
- function parseMessage(msg){
|
|
|
- if (msg==undefined)
|
|
|
- return;
|
|
|
- switch(msg.type){
|
|
|
- case "draw":
|
|
|
- drawOnCanvas(msg.points,msg.color);
|
|
|
- break;
|
|
|
- case "clean":
|
|
|
- ctx.drawImage(img,0,0,canvas.width, canvas.height);
|
|
|
- break;
|
|
|
- case "diapo":
|
|
|
- img.src="https://curso.especificosba.com.ar/diapo/{0}/{1}.png".format(msg.PDF,msg.slide);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- function drawOnCanvas(points,color) {
|
|
|
- if(points.length==0) return;
|
|
|
- ctx.strokeStyle = color;
|
|
|
- ctx.beginPath();
|
|
|
- ctx.moveTo(points[0].x, points[0].y);
|
|
|
-
|
|
|
- for(var i=1; i<points.length; i++) {
|
|
|
- ctx.lineTo(points[i].x, points[i].y);
|
|
|
- }
|
|
|
- ctx.stroke();
|
|
|
- }
|
|
|
|
|
|
$scope.post = function() {
|
|
|
var data = {
|
|
|
@@ -92,4 +34,3 @@ app.controller('uploadCtrl', function ($scope, $http,video,notify) {
|
|
|
});
|
|
|
};
|
|
|
});
|
|
|
-
|