diff --git a/editor/locale/lang.es.js b/editor/locale/lang.es.js
index e3742110..0b279e3a 100644
--- a/editor/locale/lang.es.js
+++ b/editor/locale/lang.es.js
@@ -1,155 +1,158 @@
[
{"id":"layer_new","title":"Nueva capa"},
-{"id":"layer_delete","title":"Eliminar capa"},
-{"id":"layer_rename","title":"Cambie el nombre de la capa"},
-{"id":"layer_up","title":"Mover la capa Up"},
-{"id":"layer_down","title":"Mover la capa de Down"},
-{"id":"tool_clear","title":"Nueva imagen [N]"},
-{"id":"tool_open","title":"Abrir imagen [O]"},
-{"id":"tool_save","title":"Guardar imagen [S]"},
-{"id":"tool_docprops","title":"Propiedades del documento [I]"},
-{"id":"tool_source","title":"Fuente Editar [U]"},
-{"id":"tool_undo","title":"Deshacer [Z]"},
-{"id":"tool_redo","title":"Rehacer [Y]"},
-{"id":"tool_clone","title":"Clone Elemento [C]"},
-{"id":"tool_delete","title":"Eliminar elemento [Delete/Backspace]"},
-{"id":"tool_move_top","title":"Mover al principio [Shift Up]"},
-{"id":"tool_move_bottom","title":"Mover al final [Shift Down]"},
-{"id":"group_opacity","title":"Cambiar la opacidad tema seleccionado"},
+{"id":"layer_delete","title":"Suprimir capa"},
+{"id":"layer_rename","title":"Renombrar capa"},
+{"id":"layer_up","title":"Mover la capa hacia arriba"},
+{"id":"layer_down","title":"Mover la capa hacia abajo"},
+{"id":"tool_clear","title":"Nueva imagen"},
+{"id":"tool_open","title":"Abrir imagen"},
+{"id":"tool_save","title":"Guardar imagen"},
+{"id":"tool_docprops","title":"Propiedades del documento"},
+{"id":"tool_source","title":"Editar código fuente"},
+{"id":"tool_undo","title":"Deshacer"},
+{"id":"tool_redo","title":"Rehacer"},
+{"id":"tool_clone","title":"Clonar Elemento"},
+{"id":"tool_delete","title":"Suprimir elemento"},
+{"id":"tool_move_top","title":"Mover arriba"},
+{"id":"tool_move_bottom","title":"Mover abajo"},
+{"id":"group_opacity","title":"Cambiar la opacidad de elemento seleccionado"},
{"id":"angle","title":"Cambiar el ángulo de rotación"},
-{"id":"tool_clone_multi","title":"Elementos Clone [C]"},
-{"id":"tool_delete_multi","title":"Eliminar elementos seleccionados [Delete/Backspace]"},
-{"id":"tool_alignleft","title":"Alinear a la izquierda"},
-{"id":"tool_aligncenter","title":"Alinear al centro"},
-{"id":"tool_alignright","title":"Alinear a la derecha"},
-{"id":"tool_aligntop","title":"Alinear arriba"},
-{"id":"tool_alignmiddle","title":"Alinear Medio"},
-{"id":"tool_alignbottom","title":"Alinear abajo"},
+{"id":"tool_clone_multi","title":" Clonar elementos"},
+{"id":"tool_delete_multi","title":"Suprimir los elementos seleccionados"},
+{"id":"tool_alignleft","title":"Alinear lado izquierdo"},
+{"id":"tool_aligncenter","title":"Centrar verticalmente"},
+{"id":"tool_alignright","title":"Alinear lado derecho"},
+{"id":"tool_aligntop","title":"Alinear parte superior"},
+{"id":"tool_alignmiddle","title":"Centrar horizontalmente"},
+{"id":"tool_alignbottom","title":"Alinear parte inferior"},
{"id":"align_relative_to","title":"Alinear con respecto a ..."},
-{"id":"tool_group","title":"Elementos de Grupo de [G]"},
-{"id":"tool_ungroup","title":"Desagrupar elementos [G]"},
-{"id":"rect_width","title":"Ancho rectángulo Cambio"},
-{"id":"rect_height","title":"Rectángulo de altura Cambio"},
-{"id":"rect_rx","title":"Cambiar Rectángulo Corner Radius"},
-{"id":"image_width","title":"Ancho de la imagen Cambio"},
+{"id":"tool_group","title":"Agrupar elementos"},
+{"id":"tool_ungroup","title":"Desagrupar elementos"},
+{"id":"rect_width","title":"Cambiar el ancho rectángulo"},
+{"id":"rect_height","title":"Cambiar la altura del rectágulo"},
+{"id":"rect_rx","title":"Cambiar el radio de las esquinas del rectángulo"},
+{"id":"image_width","title":"Cambiar el ancho de la imagen"},
{"id":"image_height","title":"Cambiar la altura de la imagen"},
-{"id":"image_url","title":"Cambiar URL"},
-{"id":"circle_cx","title":"CX círculo Cambio de coordenadas"},
-{"id":"circle_cy","title":"Círculo Cambio CY coordinar"},
-{"id":"circle_r","title":"Radio de círculo Cambio"},
-{"id":"ellipse_cx","title":"Cambiar elipse CX coordinar"},
-{"id":"ellipse_cy","title":"Elipse Cambio CY coordinar"},
-{"id":"ellipse_rx","title":"Radio x elipse Cambio"},
-{"id":"ellipse_ry","title":"Radio y elipse Cambio"},
-{"id":"line_x1","title":"Cambiar la línea de partida de la coordenada x"},
-{"id":"line_y1","title":"Cambiar la línea de partida y de coordinar"},
-{"id":"line_x2","title":"Cambiar la línea de horas de coordenada x"},
-{"id":"line_y2","title":"Cambiar la línea de horas de coordenada"},
-{"id":"tool_bold","title":"Texto en negrita [B]"},
-{"id":"tool_italic","title":"Texto en cursiva [I]"},
-{"id":"font_family","title":"Cambiar la fuente Familia"},
-{"id":"font_size","title":"Change Font Size"},
-{"id":"text","title":"Contenido del texto"},
-{"id":"tool_select","title":"Herramienta de selección [1]"},
-{"id":"tool_fhpath","title":"Herramienta Lápiz [2]"},
-{"id":"tool_line","title":"La herramienta [3]"},
-{"id":"tools_rect_show","title":"Cuadrado / Rect Herramienta [4/Shift 4]"},
-{"id":"tools_ellipse_show","title":"Elipse / Herramienta Círculo [5/Shift 5]"},
-{"id":"tool_text","title":"Herramienta de texto [6]"},
-{"id":"tool_path","title":"Path Tool [7]"},
-{"id":"tool_image","title":"Image Tool [8]"},
-{"id":"tool_zoom","title":"Zoom Tool [Ctrl Up/Down]"},
+{"id":"image_url","title":"Modificar URL"},
+{"id":"circle_cx","title":"Cambiar la posición horizonral cx del círculo"},
+{"id":"circle_cy","title":"Cambiar la posición vertical cy del círculo"},
+{"id":"circle_r","title":"Cambiar el radio del círculo"},
+{"id":"ellipse_cx","title":"Cambiar la posición horizontal cx de la elipse"},
+{"id":"ellipse_cy","title":"Cambiar la posición vertical cy de la elipse"},
+{"id":"ellipse_rx","title":"Cambiar el radio horizontal x de la elipse"},
+{"id":"ellipse_ry","title":"Cambiar el radio vertical y de la elipse"},
+{"id":"line_x1","title":"Cambiar la posición horizontal x del comienzo de la línea"},
+{"id":"line_y1","title":"Cambiar la posición vertical y del comienzo de la línea"},
+{"id":"line_x2","title":"Cambiar la posición horizontal x del final de la línea"},
+{"id":"line_y2","title":"Cambiar la poición vertical y del final de la línea"},
+{"id":"tool_bold","title":"Texto en"},
+{"id":"tool_italic","title":"Texto en cursiva"},
+{"id":"font_family","title":"Cambiar el tipo de fuente"},
+{"id":"font_size","title":"Change el tamaño de la fuente"},
+{"id":"text","title":"Cambiar el contenido del texto"},
+{"id":"tool_select","title":"Herramienta de selección"},
+{"id":"tool_fhpath","title":"Herramienta de lápiz"},
+{"id":"tool_line","title":"Herramienta de trazado de lineas"},
+{"id":"tools_rect_show","title":"Herramienta de cuadrado / rectángulo"},
+{"id":"tools_ellipse_show","title":"Herramienta de círculo / elipse"},
+{"id":"tool_text","title":"Herramienta de texto"},
+{"id":"tool_path","title":"Herramienta de ruta"},
+{"id":"tool_image","title":"Herramienta de imagen"},
+{"id":"tool_zoom","title":"Herramienta de zoom"},
{"id":"zoom","title":"Cambiar el nivel de zoom"},
{"id":"fill_color","title":"Cambiar el color de relleno"},
-{"id":"stroke_color","title":"Cambiar el color del trazo"},
-{"id":"stroke_width","title":"Cambiar la anchura del trazo"},
-{"id":"stroke_style","title":"Cambiar estilo de trazo guión"},
-{"id":"palette","title":"Haga clic para cambiar el color de relleno, shift-clic para cambiar el color del trazo"},
+{"id":"stroke_color","title":"Cambiar el color del contorno"},
+{"id":"stroke_width","title":"Cambiar el ancho del contorno"},
+{"id":"stroke_style","title":"Cambiar el estilo del trazo del contorno"},
+{"id":"palette","title":"Haga clic para cambiar el color de relleno, haga Mayús-clic para cambiar el color del contorno"},
{"id":"tool_square","title":"Cuadrado"},
{"id":"tool_rect","title":"Rectángulo"},
-{"id":"tool_fhrect","title":"Free-Hand Rectángulo"},
+{"id":"tool_fhrect","title":"Rectángulo a mano alzada"},
{"id":"tool_circle","title":"Círculo"},
{"id":"tool_ellipse","title":"Elipse"},
-{"id":"tool_fhellipse","title":"Free-Hand Ellipse"},
-{"id":"bkgnd_color","title":"Color de fondo / opacidad"},
+{"id":"tool_fhellipse","title":"Elipse a mano alzada"},
+{"id":"bkgnd_color","title":"Cambiar color de fondo / opacidad"},
{"id":"rwidthLabel","textContent":"Ancho:"},
-{"id":"rheightLabel","textContent":"Altura:"},
+{"id":"rheightLabel","textContent":"Alto:"},
{"id":"cornerRadiusLabel","textContent":"Radio de la esquina:"},
-{"id":"iwidthLabel","textContent":"anchura:"},
-{"id":"iheightLabel","textContent":"altura:"},
-{"id":"svginfo_width","textContent":"Anchura:"},
-{"id":"svginfo_height","textContent":"Altura:"},
-{"id":"angleLabel","textContent":"ángulo:"},
+{"id":"iwidthLabel","textContent":"ancho:"},
+{"id":"iheightLabel","textContent":"alto:"},
+{"id":"svginfo_width","textContent":"Ancho:"},
+{"id":"svginfo_height","textContent":"Alto:"},
+{"id":"angleLabel","textContent":"águlo:"},
{"id":"relativeToLabel","textContent":"en relación con:"},
{"id":"zoomLabel","textContent":"Zoom:"},
-{"id":"svninfo_change_background","textContent":"Lienzo de fondo"},
-{"id":"layersLable","textContent":"Capas:"},
-{"id":"selectedPredefined","textContent":"Seleccione predefinidas:"},
+{"id":"layersLabel","textContent":"Capas:"},
+{"id":"selectedPredefined","textContent":"Seleccionar predefinido:"},
{"id":"fitToContent","textContent":"Ajustar al contenido"},
-{"id":"tool_source_save","textContent":"Apply Changes"},
+{"id":"tool_source_save","textContent":"Aplicar cambios"},
{"id":"tool_docprops_save","textContent":"OK"},
{"id":"tool_docprops_cancel","textContent":"Cancelar"},
{"id":"tool_source_cancel","textContent":"Cancelar"},
{"id":"fit_to_all","textContent":"Ajustar a todo el contenido"},
-{"id":"fit_to_layer_content","textContent":"Ajustar al contenido de la capa de"},
+{"id":"fit_to_layer_content","textContent":"Ajustar al contenido de la capa"},
{"id":"fit_to_sel","textContent":"Ajustar a la selección"},
-{"id":"fit_to_canvas","textContent":"Ajustar a la lona"},
-{"id":"selected_objects","textContent":"objetos elegidos"},
-{"id":"largest_object","textContent":"objeto más grande"},
-{"id":"smallest_object","textContent":"objeto más pequeño"},
+{"id":"fit_to_canvas","textContent":"Ajustar al lienzo"},
+{"id":"selected_objects","textContent":"Objetos seleccionados"},
+{"id":"largest_object","textContent":"El objeto más grande"},
+{"id":"smallest_object","textContent":"El objeto más pequeño"},
{"id":"page","textContent":"Página"},
-{"id":"fill_tool_bottom","textContent":"llenar:"},
-{"id":"stroke_tool_bottom","textContent":"golpe:"},
-{"id":"svninfo_dim","textContent":"Dimensiones lienzo"}
-{"id":"path_node_x","title":"Change node's x coordinate"},
-{"id":"path_node_y","title":"Change node's y coordinate"},
-{"id":"seg_type","title":"Change Segment type"},
-{"id":"straight_segments","textContent":"Straight"},
-{"id":"curve_segments","textContent":"Curve"},
-{"id":"tool_node_clone","title":"Clone Node"},
-{"id":"tool_node_delete","title":"Delete Node"},
-{"id":"selLayerLabel","textContent":"Move elements to:"},
-{"id":"selLayerNames","title":"Move selected elements to a different layer"},
-{"id":"sidepanel_handle","title":"Drag left/right to resize side panel [X]","textContent":"L a y e r s"},
-{"id":"tool_wireframe","title":"Wireframe Mode [F]"},
-{"id":"svginfo_image_props","textContent":"Image Properties"},
-{"id":"svginfo_title","textContent":"Title"},
-{"id":"svginfo_dim","textContent":"Canvas Dimensions"},
-{"id":"includedImages","textContent":"Included Images"},
-{"id":"image_opt_embed","textContent":"Embed data (local files)"},
-{"id":"image_opt_ref","textContent":"Use file reference"},
-{"id":"svginfo_editor_prefs","textContent":"Editor Preferences"},
-{"id":"svginfo_lang","textContent":"Language"},
-{"id":"svginfo_change_background","textContent":"Editor Background"},
-{"id":"svginfo_bg_note","textContent":"Note: Background will not be saved with image."},
-{"id":"svginfo_icons","textContent":"Icon size"},
-{"id":"icon_small","textContent":"Small"},
-{"id":"icon_medium","textContent":"Medium"},
-{"id":"icon_large","textContent":"Large"},
-{"id":"icon_xlarge","textContent":"Extra Large"},
-{"id":"selected_x","title":"Change X coordinate"},
-{"id":"selected_y","title":"Change Y coordinate"},
-{"id":"tool_topath","title":"Convert to Path"},
-{"id":"tool_reorient","title":"Reorient path"},
-{"id":"tool_node_link","title":"Link Control Points"},
+{"id":"fill_tool_bottom","textContent":"Rellenar:"},
+{"id":"stroke_tool_bottom","textContent":"Contorno:"},
+{"id":"svninfo_dim","textContent":"Dimensiones del lienzo"},
+{"id":"path_node_x","title":"Cambiar la posición horizontal x del nodo"},
+{"id":"path_node_y","title":"Cambiar la posición vertical y del nodo"},
+{"id":"seg_type","title":"Cambiar el tipo de segmento"},
+{"id":"straight_segments","textContent":"Recto"},
+{"id":"curve_segments","textContent":"Curvo"},
+{"id":"tool_node_clone","title":"Clonar nodo"},
+{"id":"tool_node_delete","title":"Suprimir nodo"},
+{"id":"selLayerLabel","textContent":"Desplazar elementos hacia:"},
+{"id":"selLayerNames","title":"Mover los elementos seleccionados a otra capa"},
+{"id":"sidepanel_handle","title":"Arrastrar hacia la izquierda/derecha para modificar el tamaño del panel lateral","textContent":"C a p a s"},
+{"id":"tool_wireframe","title":"Modo wireframe"},
+{"id":"svginfo_image_props","textContent":"Propiedades de Imagen"},
+{"id":"svginfo_title","textContent":"Título"},
+{"id":"svginfo_dim","textContent":"Tamaño del lienzo"},
+{"id":"includedImages","textContent":"Imágenes integradas"},
+{"id":"image_opt_embed","textContent":"Integrar imágenes en forma de datos (archivos locales)"},
+{"id":"image_opt_ref","textContent":"Usar la referencia del archivo"},
+{"id":"svginfo_editor_prefs","textContent":"Preferencias del Editor"},
+{"id":"svginfo_lang","textContent":"Idioma"},
+{"id":"svginfo_change_background","textContent":"Fondo del Editor"},
+{"id":"svginfo_bg_note","textContent":"Note: El fondo no se guardará junto con la imagen."},
+{"id":"svginfo_icons","textContent":"Tamaño del icono"},
+{"id":"icon_small","textContent":"Pequeño"},
+{"id":"icon_medium","textContent":"Mediano"},
+{"id":"icon_large","textContent":"Grande"},
+{"id":"icon_xlarge","textContent":"Muy grande"},
+{"id":"selected_x","title":"Cambiar la posición horizontal X"},
+{"id":"selected_y","title":"Cambiar la posición vertical Y"},
+{"id":"tool_topath","title":"Convertir en ruta"},
+{"id":"tool_reorient","title":"Reorientar la ruta"},
+{"id":"tool_node_link","title":"Enlazar puntos de control"},
{"js_strings": {
- "invalidAttrValGiven":"Invalid value given",
- "noContentToFitTo":"No content to fit to",
- 'layer':"Layer",
- "dupeLayerName":"There is already a layer named that!",
- "enterUniqueLayerName":"Please enter a unique layer name",
- "enterNewLayerName":"Please enter the new layer name",
- "layerHasThatName":"Layer already has that name",
- "QmoveElemsToLayer":"Move selected elements to layer '%s'?",
- "QwantToClear":"Do you want to clear the drawing?\nThis will also erase your undo history!",
- "QerrorsRevertToSource":"There were parsing errors in your SVG source.\nRevert back to original SVG source?",
- "QignoreSourceChanges":"Ignore changes made to SVG source?",
- "featNotSupported":"Feature not supported",
- "enterNewImgURL":"Enter the new image URL",
+ "invalidAttrValGiven":"Valor no válido",
+ "noContentToFitTo":"No existe un contenido al que ajustarse.",
+ 'layer':"Capa",
+ "dupeLayerName":"¡Ya existe una capa con este nombre!",
+ "enterUniqueLayerName":"Introduzca otro nombre distinto para la capa.",
+ "enterNewLayerName":"Introduzca el nuevo nombre de la capa.",
+ "layerHasThatName":"El nombre introducido es el nombre actual de la capa.",
+ "QmoveElemsToLayer":"¿Desplazar los elementos seleccionados a la capa '%s'?",
+ "QwantToClear":"¿Desea suprimir el dibujo?\n¡El historial de acciones también se borrará!",
+ "QerrorsRevertToSource":"Existen errores sintácticos en su código fuente SVG.\n¿Desea volver al código fuente SVG original?",
+ "QignoreSourceChanges":"¿Desea ignorar los cambios realizados sobre el código fuente SVG?",
+ "featNotSupported":"Función no compatible.",
+ "enterNewImgURL":"Introduzca la nueva URL de la imagen.",
"ok":"OK",
- "cancel":"Cancel",
- "pathNodeTooltip":"Drag node to move it. Double-click node to change segment type",
- "pathCtrlPtTooltip":"Drag control point to adjust curve properties"
+ "cancel":"Cancelar",
+ "pathNodeTooltip":"Arrastre el nodo para desplazarlo. Haga doble clic sobre el nodo para cambiar el tipo de segmento.",
+ "pathCtrlPtTooltip":"Arrastre el punto de control para ajustar las propiedades de la curva.",
+ "key_up":"arriba",
+ "key_down":"abajo",
+ "key_backspace":"retroceso",
+ "key_del":"suprimir"
}
}
]
\ No newline at end of file
diff --git a/editor/svg-editor.html b/editor/svg-editor.html
index 5cb52e0c..8156cab1 100644
--- a/editor/svg-editor.html
+++ b/editor/svg-editor.html
@@ -410,6 +410,7 @@ script type="text/javascript" src="locale/locale.min.js">
+
diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js
index 9fe7cd5a..dde9b340 100644
--- a/editor/svgcanvas.js
+++ b/editor/svgcanvas.js
@@ -3064,6 +3064,93 @@ function BatchCommand(text) {
call("changed", selectedElements);
}
+ // If the path was rotated, we must now pay the piper:
+ // Every path point must be rotated into the rotated coordinate system of
+ // its old center, then determine the new center, then rotate it back
+ // This is because we want the path to remember its rotation
+
+ // TODO: This is still using ye olde transform methods, can probably
+ // be optimized or even taken care of by recalculateDimensions
+ var recalcRotatedPath = function() {
+ var angle = canvas.getRotationAngle(current_path, true);
+ if(!angle) return;
+ var box = canvas.getBBox(current_path);
+ var oldbox = selectedBBoxes[0];
+ var oldcx = oldbox.x + oldbox.width/2,
+ oldcy = oldbox.y + oldbox.height/2,
+ newcx = box.x + box.width/2,
+ newcy = box.y + box.height/2;
+
+ // un-rotate the new center to the proper position
+ var dx = newcx - oldcx,
+ dy = newcy - oldcy;
+ var r = Math.sqrt(dx*dx + dy*dy);
+ var theta = Math.atan2(dy,dx) + angle;
+ newcx = r * Math.cos(theta) + oldcx;
+ newcy = r * Math.sin(theta) + oldcy;
+
+ var getRotVals = function(x, y) {
+ dx = x - oldcx;
+ dy = y - oldcy;
+
+ // rotate the point around the old center
+ r = Math.sqrt(dx*dx + dy*dy);
+ theta = Math.atan2(dy,dx) + angle;
+ dx = r * Math.cos(theta) + oldcx;
+ dy = r * Math.sin(theta) + oldcy;
+
+ // dx,dy should now hold the actual coordinates of each
+ // point after being rotated
+
+ // now we want to rotate them around the new center in the reverse direction
+ dx -= newcx;
+ dy -= newcy;
+
+ r = Math.sqrt(dx*dx + dy*dy);
+ theta = Math.atan2(dy,dx) - angle;
+
+ return {'x':(r * Math.cos(theta) + newcx)/1,
+ 'y':(r * Math.sin(theta) + newcy)/1};
+ }
+
+ var list = current_path.pathSegList;
+ var i = list.numberOfItems;
+ while (i) {
+ i -= 1;
+ var seg = list.getItem(i);
+ var type = seg.pathSegType;
+ if(type == 1) continue;
+
+ var rvals = getRotVals(seg.x,seg.y);
+ var points = [rvals.x, rvals.y];
+ if(seg.x1 != null && seg.x2 != null) {
+ c_vals1 = getRotVals(seg.x1, seg.y1);
+ c_vals2 = getRotVals(seg.x2, seg.y2);
+ points.splice(points.length, 0, c_vals1.x , c_vals1.y, c_vals2.x, c_vals2.y);
+ }
+ replacePathSeg(type, i, points);
+ } // loop for each point
+
+ box = canvas.getBBox(current_path);
+ selectedBBoxes[0].x = box.x; selectedBBoxes[0].y = box.y;
+ selectedBBoxes[0].width = box.width; selectedBBoxes[0].height = box.height;
+
+ // now we must set the new transform to be rotated around the new center
+ var R_nc = svgroot.createSVGTransform();
+ var tlist = canvas.getTransformList(current_path);
+ R_nc.setRotate((angle * 180.0 / Math.PI), newcx, newcy);
+ tlist.replaceItem(R_nc,0);
+
+ if(document.getElementById("pathpointgrip_container")) {
+ var pcx = newcx * current_zoom,
+ pcy = newcy * current_zoom;
+ var xform = ["rotate(", (angle*180.0/Math.PI), " ", pcx, ",", pcy, ")"].join("");
+ setPointContainerTransform(xform);
+ }
+ resetPointGrips();
+ updateSegLine(true);
+ }
+
// Rotate all points of a path and remove its transform value
var resetPathOrientation = function(path) {
if(path == null || path.nodeName != 'path') return false;
@@ -4176,88 +4263,7 @@ function BatchCommand(text) {
var oldvalues = {};
oldvalues["d"] = current_path_oldd;
- // If the path was rotated, we must now pay the piper:
- // Every path point must be rotated into the rotated coordinate system of
- // its old center, then determine the new center, then rotate it back
- // This is because we want the path to remember its rotation
- var angle = canvas.getRotationAngle(current_path, true);
-
- if (angle) {
- var box = canvas.getBBox(current_path);
- var oldbox = selectedBBoxes[0];
- var oldcx = oldbox.x + oldbox.width/2,
- oldcy = oldbox.y + oldbox.height/2,
- newcx = box.x + box.width/2,
- newcy = box.y + box.height/2;
-
- // un-rotate the new center to the proper position
- var dx = newcx - oldcx,
- dy = newcy - oldcy;
- var r = Math.sqrt(dx*dx + dy*dy);
- var theta = Math.atan2(dy,dx) + angle;
- newcx = r * Math.cos(theta) + oldcx;
- newcy = r * Math.sin(theta) + oldcy;
-
- var getRotVals = function(x, y) {
- dx = x - oldcx;
- dy = y - oldcy;
-
- // rotate the point around the old center
- r = Math.sqrt(dx*dx + dy*dy);
- theta = Math.atan2(dy,dx) + angle;
- dx = r * Math.cos(theta) + oldcx;
- dy = r * Math.sin(theta) + oldcy;
-
- // dx,dy should now hold the actual coordinates of each
- // point after being rotated
-
- // now we want to rotate them around the new center in the reverse direction
- dx -= newcx;
- dy -= newcy;
-
- r = Math.sqrt(dx*dx + dy*dy);
- theta = Math.atan2(dy,dx) - angle;
-
- return {'x':(r * Math.cos(theta) + newcx)/1,
- 'y':(r * Math.sin(theta) + newcy)/1};
- }
-
- var list = current_path.pathSegList;
- var i = list.numberOfItems;
- while (i) {
- i -= 1;
- var seg = list.getItem(i);
- var type = seg.pathSegType;
- if(type == 1) continue;
-
- var rvals = getRotVals(seg.x,seg.y);
- var points = [rvals.x, rvals.y];
- if(seg.x1 != null && seg.x2 != null) {
- c_vals1 = getRotVals(seg.x1, seg.y1);
- c_vals2 = getRotVals(seg.x2, seg.y2);
- points.splice(points.length, 0, c_vals1.x , c_vals1.y, c_vals2.x, c_vals2.y);
- }
- replacePathSeg(type, i, points);
- } // loop for each point
-
- box = canvas.getBBox(current_path);
- selectedBBoxes[0].x = box.x; selectedBBoxes[0].y = box.y;
- selectedBBoxes[0].width = box.width; selectedBBoxes[0].height = box.height;
-
- // now we must set the new transform to be rotated around the new center
- var rotate = "rotate(" + (angle * 180.0 / Math.PI) + " " + newcx + "," + newcy + ")";
- current_path.setAttribute("transform", rotate);
-
- if(document.getElementById("pathpointgrip_container")) {
- var pcx = newcx * current_zoom,
- pcy = newcy * current_zoom;
- var xform = ["rotate(", (angle*180.0/Math.PI), " ", pcx, ",", pcy, ")"].join("");
- setPointContainerTransform(xform);
- }
- resetPointGrips();
- updateSegLine(true);
-
- } // if rotated
+ recalcRotatedPath();
batchCmd.addSubCommand(new ChangeElementCommand(current_path, oldvalues, "path points"));
addCommandToHistory(batchCmd);
@@ -4274,7 +4280,9 @@ function BatchCommand(text) {
} // if (current_path_pt_drag != -1)
else if(current_ctrl_pt_drag != -1) {
current_ctrl_pt_drag = -1;
- var batchCmd = new BatchCommand("Edit Path control points");
+ recalcRotatedPath();
+ updateSegLine();
+ var batchCmd = new BatchCommand("Edit Path control points");
batchCmd.addSubCommand(new ChangeElementCommand(current_path, {d:current_path_oldd}));
addCommandToHistory(batchCmd);
call("changed", [current_path]);