diff --git a/common/lib/xmodule/xmodule/js/src/capa/schematic.js b/common/lib/xmodule/xmodule/js/src/capa/schematic.js index b503f59966..63edb278d8 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/schematic.js +++ b/common/lib/xmodule/xmodule/js/src/capa/schematic.js @@ -2810,7 +2810,7 @@ schematic = (function() { // for each requested freq, interpolate response value for (var k = 1; k < flist.length; k++) { var f = flist[k]; - var v = interpolate(f,x_values,values); + var v = interpolate(f,x_values,values); //xss-lint: disable=javascript-interpolate // convert to dB fvlist.push([f,v == undefined ? 'undefined' : 20.0 * Math.log(v)/Math.LN10]); } @@ -2932,7 +2932,7 @@ schematic = (function() { // for each requested time, interpolate waveform value for (var k = 1; k < tlist.length; k++) { var t = tlist[k]; - var v = interpolate(t,times,values); + var v = interpolate(t,times,values); // xss-lint: disable=javascript-interpolate tvlist.push([t,v == undefined ? 'undefined' : v]); } // save results as list of [t,value] pairs @@ -2978,7 +2978,7 @@ schematic = (function() { // t is the time at which we want a value // times is a list of timepoints from the simulation - function interpolate(t,times,values) { + function interpolate(t,times,values) { // xss-lint: disable=javascript-interpolate if (values == undefined) return undefined; for (var i = 0; i < times.length; i++) @@ -4588,7 +4588,7 @@ schematic = (function() { this.canvas.style.cursor = 'default'; this.canvas.height = part_w; this.canvas.width = part_h; - this.canvas.part = this; + this.canvas.xpart = this; this.canvas.addEventListener('mouseover',part_enter,false); this.canvas.addEventListener('mouseout',part_leave,false); @@ -4680,7 +4680,7 @@ schematic = (function() { function part_enter(event) { if (!event) event = window.event; var canvas = (window.event) ? event.srcElement : event.target; - var part = canvas.part; + var part = canvas.xpart; // avoid Chrome bug that changes to text cursor whenever // drag starts. We'll restore the default handler at @@ -4697,7 +4697,7 @@ schematic = (function() { function part_leave(event) { if (!event) event = window.event; var canvas = (window.event) ? event.srcElement : event.target; - var part = canvas.part; + var part = canvas.xpart; if (typeof part.sch.new_part == 'undefined') { // leaving with no part selected? revert handler @@ -4711,7 +4711,7 @@ schematic = (function() { function part_mouse_down(event) { if (!event) event = window.event; - var part = (window.event) ? event.srcElement.part : event.target.part; + var part = (window.event) ? event.srcElement.xpart : event.target.xpart; part.select(true); part.sch.new_part = part; @@ -4720,7 +4720,7 @@ schematic = (function() { function part_mouse_up(event) { if (!event) event = window.event; - var part = (window.event) ? event.srcElement.part : event.target.part; + var part = (window.event) ? event.srcElement.xpart : event.target.xpart; part.select(false); part.sch.new_part = undefined; @@ -5099,9 +5099,15 @@ schematic = (function() { } ConnectionPoint.prototype.toString = function() { - return ''; + return edx.StringUtils.interpolate('', + { + offset_x: this.offset_x, + offset_y: this.offset_y, + parent: edx.HtmlUtils.ensureHTML(this.parent.toString()) + }); } + ConnectionPoint.prototype.json = function() { return this.label; } @@ -5213,9 +5219,16 @@ schematic = (function() { } Wire.prototype = new Component(); Wire.prototype.constructor = Wire; - - Wire.prototype.toString = function() { - return ''; + + Wire.prototype.toString = function() { + return edx.StringUtils.interpolate( + '', + { + x: this.x, + y: this.y, + x_plus_dx: this.x + this.dx, + y_plus_dy: this.y + this.dy + }); } // return connection point at other end of wire from specified cp @@ -5328,9 +5341,14 @@ schematic = (function() { Ground.prototype.constructor = Ground; Ground.prototype.toString = function() { - return ''; + return edx.StringUtils.interpolate( + '', + { + x: this.x, + y: this.y + }); } - + Ground.prototype.draw = function(c) { Component.prototype.draw.call(this,c); // give superclass a shot this.draw_line(c,0,0,0,8); @@ -5369,7 +5387,12 @@ schematic = (function() { Label.prototype.constructor = Label; Label.prototype.toString = function() { - return ''; + return edx.StringUtils.interpolate( + '