<commit_before>(function($, MITHGrid) {
	/**
	* MITHGrid Canvas
	* Creates a canvas using the Raphael JS library
	*/
	
	// Set the namespace for the Canvas application
	MITHGrid.Application.namespace("Canvas");
	MITHGrid.Application.Canvas.initApp = function(container, options) {
	
		var that = MITHGrid.Application.initApp("MITHGrid.Application.Canvas", container, $.extend(true, {}, options, {
    		dataViews: {
		        // view for the space in which data from shapes
		        // is drawn
		        drawspace: {
		            dataStore: 'canvas',
		            types: ["Rectangle", "Ellipse"],
		            label: 'drawspace'
		        }
		    },
		    viewSetup: '<div id="canvasSVG"></div>'+
			'<div class="anno_list"></div>',
		    presentations: {
		        raphsvg: {
		            type: MITHGrid.Presentation.RaphaelCanvas,
		            container: "#canvasSVG",
		            dataView: 'drawspace',
		            lenses: {
		                Rectangle: function(container, view, model, itemId) {
		                    // Note: Rectangle measurements x,y start at CENTER
		                    var that = {},
		                    item = model.getItem(itemId),
		                    c,
		                    ox,
		                    oy,
		                    // Set up drag() callback functions
		                    start = function() {
		                        ox = parseInt(c.attr("x"), 10);
		                        oy = parseInt(c.attr("y"), 10);

		                    },
		                    move = function(dx, dy) {
		                        var targets = {};
		                        // This is where we update the shape
		                        // object
		                        model.updateItems([{
		                            id: itemId,
		                            x: dx + ox,
		                            y: dy + oy
		                        }]);
		                    },
		                    up = function() {

		                        };

		                    $("#testdone").append("<p>Raphael Object in data store:<br/> " + JSON.stringify(item) + "</p>");
		                    ox = (item.x - (item.w / 2));
		                    oy = (item.y - (item.h / 2));

		                    // Accessing the view.canvas Object that was created in MITHGrid.Presentation.RaphSVG
		                    c = view.canvas.rect(ox, oy, item.w, item.h);
		                    // fill and set opacity
		                    c.attr({
		                        fill: "red",
		                        opacity: 1
		                    });

		                    that.update = function(item) {

		                        // receiving the Object passed through
		                        // model.updateItems in move()
		                        try {
		                            if (item.x !== undefined && item.y !== undefined) {
		                                c.attr({
		                                    x: item.x[0],
		                                    y: item.y[0]
		                                });
		                            }
		                        } catch(e) {
		                            console.log(e);
		                            //	c.remove();
		                        }
		                        // Raphael object is updated
		                    };

		                    that.remove = function(item) {
		                        // getting the removeItems callback
		                        c.remove();
		                    };

		                    // initiate the drag feature (RaphaelJS)
		                    c.drag(move, start, up);

		                    return that;
		                },
		                Ellipse: function(container, view, model, itemId) {
		                    var that = {},
		                    item = model.getItem(itemId),
		                    c,
		                    ox,
		                    oy,
		                    // Set up drag() callback functions
		                    start = function() {
		                        ox = parseInt(c.attr("cx"), 10);
		                        oy = parseInt(c.attr("cy"), 10);

		                    },
		                    move = function(dx, dy) {
		                        var targets = {};
		                        // This is where we update the shape
		                        // object
		                        model.updateItems([{
		                            id: itemId,
		                            x: dx + ox,
		                            y: dy + oy
		                        }]);
		                    },
		                    up = function() {

		                        };

		                    // create the shape
		                    c = view.canvas.ellipse(item.x, item.y, item.w, item.h);
							// fill shape
							c.attr({
								fill: "red"
							});
							
					
		                    that.update = function(item) {
		                        // receiving the Object passed through
		                        // model.updateItems in move()
		                        try {
		                            if (item.x !== undefined && item.y !== undefined) {
		                                c.attr({
		                                    cx: item.x[0],
		                                    cy: item.y[0]
		                                });
		                            }
		                        } catch(e) {
		                            console.log(e);
		                            //	c.remove();
		                        }
		                        // Raphael object is updated
		                    };
					
							that.remove = function() {
								c.remove();
							};

							// init drag
							try {
								c.drag(move, start, up);
						
							} catch(e) {
								console.log(e);
							}
		                    return that;

		                }
		            }<commit_msg>Committing quick changes to canvas.js<commit_after>(function($, MITHGrid) {
	/**
	* MITHGrid Canvas
	* Creates a canvas using the Raphael JS library
	*/
	
	// Set the namespace for the Canvas application
	MITHGrid.Application.namespace("Canvas");
	MITHGrid.Application.Canvas.initApp = function(container, options) {
	
		var that = MITHGrid.Application.initApp("MITHGrid.Application.Canvas", container, $.extend(true, {}, options, {
    		dataViews: {
		        // view for the space in which data from shapes
		        // is drawn
		        drawspace: {
		            dataStore: 'canvas',
		            types: ["Rectangle", "Ellipse"],
		            label: 'drawspace'
		        }
		    },
		    viewSetup: '<div id="canvasSVG"></div>'+
			'<div class="anno_list"></div>',
		    presentations: {
		        raphsvg: {
		            type: MITHGrid.Presentation.RaphaelCanvas,
		            container: "#canvasSVG",
		            dataView: 'drawspace',
		            lenses: {
		                Rectangle: function(container, view, model, itemId) {
		                    // Note: Rectangle measurements x,y start at CENTER
		                    var that = {},
		                    item = model.getItem(itemId),
		                    c,
		                    ox,
		                    oy,
		                    // Set up drag() callback functions
		                    start = function() {
		                        ox = parseInt(c.attr("x"), 10);
		                        oy = parseInt(c.attr("y"), 10);

		                    },
		                    move = function(dx, dy) {
		                        var targets = {};
		                        // This is where we update the shape
		                        // object
		                        model.updateItems([{
		                            id: itemId,
		                            x: dx + ox,
		                            y: dy + oy
		                        }]);
		                    },
		                    up = function() {

		                        };

		                    $("#testdone").append("<p>Raphael Object in data store:<br/> " + JSON.stringify(item) + "</p>");
		                    ox = (item.x - (item.w / 2));
		                    oy = (item.y - (item.h / 2));

		                    // Accessing the view.canvas Object that was created in MITHGrid.Presentation.RaphSVG
		                    c = view.canvas.rect(ox, oy, item.w, item.h);
		                    // fill and set opacity
		                    c.attr({
		                        fill: "red",
		                        opacity: 1
		                    });

		                    that.update = function(item) {

		                        // receiving the Object passed through
		                        // model.updateItems in move()
		                        try {
		                            if (item.x !== undefined && item.y !== undefined) {
		                                c.attr({
		                                    x: item.x[0],
		                                    y: item.y[0]
		                                });
		                            }
		                        } catch(e) {
		                            console.log(e);
		                        }
		                        // Raphael object is updated
		                    };

		                    that.remove = function(item) {
		                        // getting the removeItems callback
		                        c.remove();
		                    };

		                    // initiate the drag feature (RaphaelJS)
		                    c.drag(move, start, up);

		                    return that;
		                },
		                Ellipse: function(container, view, model, itemId) {
		                    var that = {},
		                    item = model.getItem(itemId),
		                    c,
		                    ox,
		                    oy,
		                    // Set up drag() callback functions
		                    start = function() {
		                        ox = parseInt(c.attr("cx"), 10);
		                        oy = parseInt(c.attr("cy"), 10);

		                    },
		                    move = function(dx, dy) {
		                        var targets = {};
		                        // This is where we update the shape
		                        // object
		                        model.updateItems([{
		                            id: itemId,
		                            x: dx + ox,
		                            y: dy + oy
		                        }]);
		                    },
		                    up = function() {

		                        };

		                    // create the shape
		                    c = view.canvas.ellipse(item.x, item.y, item.w, item.h);
							// fill shape
							c.attr({
								fill: "red"
							});
							
					
		                    that.update = function(item) {
		                        // receiving the Object passed through
		                        // model.updateItems in move()
		                        try {
		                            if (item.x !== undefined && item.y !== undefined) {
		                                c.attr({
		                                    cx: item.x[0],
		                                    cy: item.y[0]
		                                });
		                            }
		                        } catch(e) {
		                            console.log(e);
		                        }
		                        // Raphael object is updated
		                    };
					
							that.remove = function() {
								c.remove();
							};

							// init drag
							try {
								c.drag(move, start, up);
						
							} catch(e) {
								console.log(e);
							}
		                    return that;

		                }
		            }
{'fraction_non_alphanumeric': 0.09835079883181584, 'fraction_numerical': 0.0025768768252877514, 'mean_word_length': 0.698220536756126, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1491725', 'n_tokens_mistral': 3360, 'n_tokens_neox': 2444, 'n_words': 612}