Lines Matching +defs:x +defs:t

23 import i18n from 'https://deno.land/x/i18next@v23.11.4/index.js';

69 // Set a placeholder function to ignore setLineDash method for browsers that don't support it.
70 // The method is not compatible with many browsers, but we don't care if it's not supported
129 ctx.font = i18n.t("14px 'Courier'");
155 function drawPos(x, y) {
156 ctx.strokeText('X='+x+' Y='+y, x, y);
205 var x = mx2+(mw2+10)*i;
206 ctx.fillRect(x, my0, mw2, mh0);
212 ctx.rect(x, my0, mw2, mh0);
218 ctx.strokeText('○', x+9, my0+20);
243 function drawParts(tool, x, y) {
245 tool.drawTool(x, y);
247 ctx.strokeText(i18n.t('Unimplemented'), x, y);
254 ret.minx += offset.x;
255 ret.maxx += offset.x;
269 function hitRect(r, x, y){
270 return r.minx < x && x < r.maxx && r.miny < y && y < r.maxy;
298 if(mx < offset.x || my < offset.y)
354 //if (1 == menuno) debug('x='+arr[0].x + 'y='+arr[0].y);
360 //cood = { x:e.pageX, y:e.pageY }
396 if(!hitRect(pointHandle(p.x, p.y), mx - offset.x, my - offset.y))
400 // control point, even if the vertex didn't have one.
438 if("cx" in p && "cy" in p && hitRect(pointHandle(p.cx, p.cy), mx - offset.x, my - offset.y)){
445 if("dx" in p && "dy" in p && hitRect(pointHandle(p.dx, p.dy), mx - offset.x, my - offset.y)){
483 // If we haven't selected an object but clicked on an object, select it.
503 if(mx < offset.x || my < offset.y)
569 pt.x += dx;
589 mx -= offset.x;
601 var props = ["x", "cx", "dx"];
661 mx -= offset.x;
669 if((name + "x") in p1) p1[name + "x"] += dx;
677 var dx = mx - pointMoving.points[pointMovingIdx].x;
679 pointMoving.points[pointMovingIdx].x = mx;
688 curpoint[pointMovingCP + "x"] = mx;
705 var dx = nextpoint.cx - curpoint.x;
709 var newangle = Math.atan2(curpoint.y - curpoint.dy, curpoint.x - curpoint.dx);
710 nextpoint.cx = curpoint.x + len * Math.cos(newangle);
717 var dx = prevpoint.dx - prevpoint.x;
721 var newangle = Math.atan2(prevpoint.y - curpoint.cy, prevpoint.x - curpoint.cx);
722 prevpoint.dx = prevpoint.x + len * Math.cos(newangle);
749 var m = {x: mx / scale, y: my / scale}; /// Convert to the logical coordinate system before hit test
756 if(hitRect(bounds, m.x, m.y)){
798 return { x: Math.round(coord.x / gridSize) * gridSize, y: Math.round(coord.y / gridSize) * gridSize };
800 return { x: coord.x, y: coord.y };
806 return { x: (coord.x - offset.x) / scale, y: (coord.y - offset.y) / scale };
827 var x, y;
829 case 0: x = bounds.minx, y = bounds.miny; break;
830 case 1: x = (bounds.minx+bounds.maxx)/2, y = bounds.miny; break;
831 case 2: x = bounds.maxx, y = bounds.miny; break;
832 case 3: x = bounds.maxx, y = (bounds.miny+bounds.maxy)/2; break;
833 case 4: x = bounds.maxx, y = bounds.maxy; break;
834 case 5: x = (bounds.minx+bounds.maxx)/2, y = bounds.maxy; break;
835 case 6: x = bounds.minx, y = bounds.maxy; break;
836 case 7: x = bounds.minx, y = (bounds.miny+bounds.maxy)/2; break;
839 return pointHandle(x, y);
843 function pointHandle(x, y){
844 return {minx: x - handleSize, miny: y - handleSize, maxx: x + handleSize, maxy: y + handleSize};
858 offset = {x:0, y:0};
865 offset = {x:x1, y:y1};
870 function drawHandle(x, y, color, circle){
871 var r = pointHandle(x, y);
911 ctx.translate(offset.x, offset.y);
949 ctx.moveTo(pts[0].x + offset.x, pts[0].y + offset.y);
951 ctx.lineTo(pts[i].x + offset.x, pts[i].y + offset.y);
960 ctx.moveTo(pt0.x + offset.x, pt0.y + offset.y);
961 ctx.lineTo(pt[name + "x"] + offset.x, pt[name + "y"] + offset.y);
969 drawHandle(pt.x + offset.x, pt.y + offset.y,
978 drawHandle(pt.cx + offset.x, pt.cy + offset.y, '#ff7f7f', true);
982 drawHandle(pt.dx + offset.x, pt.dy + offset.y, '#ff7f7f', true);
998 function set_default(t,k,v,def){
1000 t[k] = v;
1012 dat += this.points[i].x+","+this.points[i].y;
1046 pt.x = parseFloat(pt2[pt2.length-2]);
1058 var x = this.points[j].x;
1059 if(maxx === undefined || maxx < x)
1060 maxx = x;
1061 if(minx === undefined || x < minx)
1062 minx = x;
1086 return {minx: this.points[0].x, miny: this.points[0].y,
1087 maxx: this.points[0].x + width, maxy: this.points[0].y + height};
1122 return {minx: this.points[0].x, miny: this.points[0].y - height,
1123 maxx: this.points[0].x + width, maxy: this.points[0].y};
1154 src += this.points[i-1].x+","+this.points[i-1].y+" ";
1158 src += pt.x+","+pt.y+" ";
1164 src += pt.x+","+pt.y;
1190 pt2 = ssrc.split(/[, \t]/);
1200 pt.x = parseFloat(pt2[pt2.length-2]);
1404 function checkMenu(x, y) {
1405 var no = choiceMenu(x, y);
1407 no = choiceCBox(x, y);
1409 no = choiceHBox(x, y);
1412 if (x > w0 || y > h0) no = -1;
1416 function choiceMenu(x, y) {
1420 if (x >= mx1+(mw1+10)*i && x <= mx1+mw0+(mw1+10)*i) return i;
1427 function choiceTBox(x, y) {
1429 if (x < mx0 || x > mx0+mw0) return false;
1432 if(hitRect(r, x, y)){
1445 function choiceCBox(x, y) {
1448 if (x >= mx2+(mw2+10)*i && x <= mx2+mw2+(mw2+10)*i) return i+31;
1454 function choiceHBox(x, y) {
1457 if (x >= mx3+(mw2+10)*i && x <= mx3+mw2+(mw2+10)*i) return i+41;
1472 // If the named sketch didn't exist, fire up the event of local storage change.
1489 // but the method won't work for IE6, 7, 8.
1507 // (but don't remember to redirect constructor pointer to subclass)
1536 // I wonder why Array and Object (built-in classes) don't need new operator.
1595 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1621 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1642 xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1656 /// much better, but I don't feel like to port to it at once.
1668 this.text = i18n.t(text);
1717 lay.innerHTML = i18n.t('Input image size in pixels') + ':<br>'
1718 + 'x:<input id="sizeinputx" type="text">'
1762 /// http://yaml.org/type/set.html ), but JavaScript doesn't natively
1813 /// drawTool: A function(x, y) to draw icon on the toolbar.
1846 Tool.prototype.appendPoint = function(x, y) {
1847 function addPoint(x, y){
1857 cur_shape.points.push(canvasToSrc(constrainCoord({x:x, y:y})));
1870 if(!addPoint(x, y))
1871 addPoint(x, y);
1874 addPoint(x, y);
1888 var coord = {x: mx, y: my};
1946 new Tool("select", 1, {drawTool: function(x, y){
1948 ctx.moveTo(x, y-5);
1949 ctx.lineTo(x, y+10);
1950 ctx.lineTo(x+4, y+7);
1951 ctx.lineTo(x+6, y+11);
1952 ctx.lineTo(x+8, y+9);
1953 ctx.lineTo(x+6, y+5);
1954 ctx.lineTo(x+10, y+3);
1957 ctx.strokeText('1', x+45, y+10);
1971 drawTool: function(x, y){
1974 ctx.moveTo(x, y-5);
1975 ctx.lineTo(x, y+10);
1976 ctx.lineTo(x+4, y+7);
1977 ctx.lineTo(x+6, y+11);
1978 ctx.lineTo(x+8, y+9);
1979 ctx.lineTo(x+6, y+5);
1980 ctx.lineTo(x+10, y+3);
1983 ctx.strokeText('1', x+45, y+10);
2014 drawTool: function(x, y){
2016 ctx.moveTo(x, y);
2017 ctx.lineTo(x+40, y+10);
2019 ctx.strokeText('2', x+45, y+10);
2024 ctx.moveTo(arr[0].x, arr[0].y);
2025 ctx.lineTo(arr[1].x, arr[1].y);
2031 drawTool: function(x, y){
2033 l_arrow(ctx, [{x:x, y:y+5}, {x:x+40, y:y+5}]);
2034 ctx.strokeText('2', x+45, y+10);
2044 drawTool: function(x, y){
2046 l_tarrow(ctx, [{x:x, y:y+5}, {x:x+40, y:y+5}]);
2047 ctx.strokeText('2', x+45, y+10);
2057 drawTool: function(x, y){
2059 ctx.moveTo(x, y+3);
2060 ctx.lineTo(x+39, y+3);
2061 ctx.moveTo(x, y+7);
2062 ctx.lineTo(x+39, y+7);
2063 ctx.moveTo(x+35, y);
2064 ctx.lineTo(x+40, y+5);
2065 ctx.lineTo(x+35, y+10);
2067 ctx.strokeText('2', x+45, y+10);
2078 drawTool: function(x, y){
2080 ctx.moveTo(x, y);
2081 ctx.quadraticCurveTo(x+20, y+20, x+40, y);
2083 ctx.strokeText('3', x+45, y+10);
2088 ctx.moveTo(arr[0].x, arr[0].y);
2089 ctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);
2096 drawTool: function(x, y){
2098 ctx.moveTo(x, y);
2099 ctx.quadraticCurveTo(x+20, y+20, x+40, y);
2100 l_hige(ctx, [{x:x+20, y:y+20}, {x:x+40, y:y}]);
2101 ctx.strokeText('3', x+45, y+10);
2106 ctx.moveTo(arr[0].x, arr[0].y);
2107 ctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);
2114 drawTool: function(x, y){
2116 ctx.moveTo(x, y);
2117 ctx.quadraticCurveTo(x+20, y+20, x+40, y);
2118 var a = [{x:x+20, y:y+20}, {x:x+40, y:y}];
2120 //a[0] = {x:x+10, y:y+10};
2121 a[1] = {x:x, y:y};
2123 ctx.strokeText('3', x+45, y+10);
2128 ctx.moveTo(arr[0].x, arr[0].y);
2129 ctx.quadraticCurveTo(arr[1].x, arr[1].y, arr[2].x, arr[2].y);
2140 drawTool: function(x, y){
2142 ctx.rect(x, y, 40, 10);
2144 ctx.strokeText('2', x+45, y+10);
2149 ctx.rect(arr[0].x, arr[0].y, arr[1].x-arr[0].x, arr[1].y-arr[0].y);
2155 drawTool: function(x, y){
2158 ctx.arc(x+20, (y+5)*2, 20, 0, 2 * Math.PI, false);
2161 ctx.strokeText('2', x+45, y+10);
2171 drawTool: function(x, y){
2174 ctx.fillRect(x, y, 40, 10);
2175 ctx.strokeText('2', x+45, y+10);
2182 ctx.fillRect(arr[0].x, arr[0].y, arr[1].x-arr[0].x, arr[1].y-arr[0].y);
2185 new Tool("ellipsefill", 2, {drawTool: function(x, y){
2189 ctx.arc(x+20, (y+5)*2, 20, 0, 2 * Math.PI, false);
2192 ctx.strokeText('2', x+45, y+10);
2204 drawTool: function(x, y){
2206 ctx.moveTo(x+8, y-3);
2207 ctx.lineTo(x+14, y+13);
2208 ctx.lineTo(x, y+2);
2209 ctx.lineTo(x+16, y+2);
2210 ctx.lineTo(x+2, y+13);
2213 ctx.strokeText('1', x+45, y+10);
2224 drawTool: function(x, y){
2226 ctx.moveTo(x, y);
2227 ctx.lineTo(x+5, y+7);
2228 ctx.lineTo(x+20, y);
2230 ctx.strokeText('1', x+45, y+10);
2240 drawTool: function(x, y){
2242 ctx.strokeText(i18n.t('Text'), x+3, y+10);
2243 ctx.strokeText('1', x+45, y+10);
2256 ctx.fillText(str, obj.points[0].x, obj.points[0].y);
2262 ctx.moveTo(obj.points[0].x, obj.points[0].y + 4);
2263 ctx.lineTo(obj.points[0].x + ctx.measureText(str).width, obj.points[0].y + 4);
2269 appendPoint: function(x, y){
2276 // Free variables won't work well.
2277 textLayer.canvasPos = {x:0, y:0};
2332 obj.points.push({x: lay.canvasPos.x, y: lay.canvasPos.y});
2355 var coord = canvasToSrc(constrainCoord({x:x, y:y}));
2356 textLayer.canvasPos.x = coord.x;
2363 if(dobjs[i] instanceof TextShape && hitRect(objBounds(dobjs[i], true), coord.x, coord.y)){
2382 textLayer.style.left = (canvasRect.left + scrollX + offset.x + coord.x) + 'px';
2400 drawTool: function(x, y){
2402 ctx.moveTo(x, y);
2403 ctx.lineTo(x+10, y+10);
2404 ctx.moveTo(x, y+10);
2405 ctx.lineTo(x+10, y);
2407 ctx.strokeText('1', x+45, y+10);
2411 drawTool: function(x, y){
2413 ctx.strokeText(i18n.t('Done'), x+3, y+10);
2415 ctx.arc(x+9, y+5, 8, 0, 6.28, false);
2417 ctx.strokeText('1', x+45, y+10);
2428 drawTool: function(x, y){
2430 ctx.moveTo(x, y);
2431 ctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);
2433 ctx.strokeText('n', x+45, y+10);
2440 ctx.moveTo(arr[0].x, arr[0].y);
2444 ctx.bezierCurveTo(arr[i].cx, arr[i].cy, arr[i].dx, arr[i].dy, arr[i].x, arr[i].y);
2446 ctx.bezierCurveTo(arr[i].cx, arr[i].cy, arr[i].x, arr[i].y, arr[i].x, arr[i].y);
2449 ctx.bezierCurveTo(arr[i-1].x, arr[i-1].y, arr[i].dx, arr[i].dy, arr[i].x, arr[i].y);
2451 ctx.lineTo(arr[i].x, arr[i].y);
2456 if("cx" in first2 && "cy" in first2 && (first2.cx !== first.x || first2.cy !== first.y))
2457 a[0] = {x: first2.cx, y: first2.cy};
2458 else if("dx" in first2 && "dy" in first2 && (first2.dx !== first.x || first2.dy !== first.y))
2459 a[0] = {x: first2.dx, y: first2.dy};
2468 if("dx" in last && "dy" in last && (last.dx !== last.x || last.dy !== last.y))
2469 a[0] = {x: last.dx, y: last.dy};
2470 else if("cx" in last && "cy" in last && (last.cx !== last.x || last.cy !== last.y))
2471 a[0] = {x: last.cx, y: last.cy};
2486 ctx.moveTo(pt0.x, pt0.y);
2487 ctx.lineTo(pt[name + "x"], pt[name + "y"]);
2496 var next = {x: 2 * last.x - last.dx, y: 2 * last.y - last.dy};
2498 drawHandle(next.x, next.y, "#ff7f7f", true);
2502 appendPoint: function(x, y){
2508 var d = canvasToSrc(constrainCoord({x:x, y:y}));
2523 if(d.x === prev.x && d.y === prev.y){
2537 d.cx = 2 * prev.x - prev.dx;
2564 var d = canvasToSrc(constrainCoord({x:mx, y:my}));
2565 if(0 < cur_shape.points.length && (pt.x !== d.x && pt.y !== d.y)){
2568 pt.dx = 2 * pt.x - d.x;
2575 var coord = canvasToSrc(constrainCoord({x: mx, y: my}));
2577 var dx = coord.x - pt.x;
2579 pt.x = coord.x;
2581 // Only move dx and dy along with x, y.
2594 drawTool: function(x, y){
2596 ctx.moveTo(x, y);
2597 ctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);
2599 l_hige(ctx, [{x: x+20, y: y-10}, {x: x+30, y: y+10}]);
2600 ctx.strokeText('n', x+45, y+10);
2611 drawTool: function(x, y){
2613 ctx.moveTo(x, y);
2614 ctx.bezierCurveTo(x+10, y+20, x+20, y-10, x+30, y+10);
2616 l_hige(ctx, [{x: x+10, y: y+20}, {x: x, y: y}]);
2617 l_hige(ctx, [{x: x+20, y: y-10}, {x: x+30, y: y+10}]);
2618 ctx.strokeText('n', x+45, y+10);
2646 var offset = editmode ? {x:x1, y:y1} : {x:0, y:0};
2666 // don't share this pointer with the constructor itself unless the
2682 // for IE6, IE5 (canvas element wouldn't work from the start, though)