Center Vertical / Horizontal broken
-
Not sure what happened with this function, but it doesn’t center vertically or horizontally at all with large elements. They go off the left of the canvas.
I did some digging and found the functions, and modified them to work correctly if anyone else is having this issue. Basically just remove the realWidth and realHeight variables, and add a line to adjust for the scale_factor.
editor.js
wpd_editor.centerObjectH = function (object) { if (wpd_editor.box_center_x) { object.set("left", wpd_editor.box_center_x); } else { var left = parseFloat(wpd.canvas_w) / 2; if (wpd_editor.scale_factor) { left = (parseFloat(wpd.canvas_w) * wpd_editor.scale_factor) / 2; left = left / wpd_editor.scale_factor; } object.set("left", left); } }
wpd_editor.centerObjectV = function (object) { if (wpd_editor.box_center_y) { object.set("top", wpd_editor.box_center_y); } else { var top = parseFloat(wpd.canvas_h) / 2; if (wpd_editor.scale_factor) { top = (parseFloat(wpd.canvas_h) * wpd_editor.scale_factor) / 2; top = top / wpd_editor.scale_factor; } object.set("top", top); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Center Vertical / Horizontal broken’ is closed to new replies.