@threedddplus/logoeditor 0.0.80 → 0.0.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4697,33 +4697,32 @@ var initCanvas = function initCanvas() {
4697
4697
  var onObjectMoving = function onObjectMoving(e) {
4698
4698
  use3dddPlus.getState().updateModifaction(false);
4699
4699
  var obj = e.target;
4700
- var offsetLeft = 10;
4701
- var offsetTop = 20;
4700
+ // if (
4701
+ // obj.getBoundingRect().width > obj.canvas.height ||
4702
+ // obj.getBoundingRect().height > obj.canvas.width
4703
+ // ) {
4704
+ // return;
4705
+ // }
4702
4706
  obj.setCoords();
4703
- // var curZoom = obj.canvas.getZoom();
4704
- if (obj.getScaledWidth() > obj.canvas.width) {
4705
- //Objct width is too big
4706
- // obj.scaleToWidth(obj.canvas.width - 100);
4707
- return;
4708
- }
4709
- if (obj.getScaledHeight() > obj.canvas.height) {
4710
- //Objct height is too big
4711
- // obj.scaleToHeight(obj.canvas.height - 100);
4712
- return;
4713
- }
4714
- if (obj.oCoords.br.x >= obj.canvas.width) {
4715
- obj.left = obj.left - (obj.oCoords.br.x - obj.canvas.width) - offsetLeft;
4716
- }
4717
- if (obj.oCoords.br.y >= obj.canvas.height) {
4718
- obj.top = obj.top - (obj.oCoords.br.y - obj.canvas.height) - offsetTop;
4707
+ if (obj.getBoundingRect().top < 0 || obj.getBoundingRect().left < 0) {
4708
+ obj.top = Math.max(obj.top, obj.top - obj.getBoundingRect().top);
4709
+ obj.left = Math.max(obj.left, obj.left - obj.getBoundingRect().left);
4710
+ obj.setCoords();
4719
4711
  }
4720
- if (obj.left - obj.width * obj.scaleX / 2 < 0) {
4721
- obj.left = offsetLeft + obj.width * obj.scaleX / 2;
4712
+ if (obj.getBoundingRect().top + obj.getBoundingRect().height > obj.canvas.height || obj.getBoundingRect().left + obj.getBoundingRect().width > obj.canvas.width) {
4713
+ obj.top = Math.min(obj.top, obj.canvas.height - obj.getBoundingRect().height + obj.top - obj.getBoundingRect().top);
4714
+ obj.left = Math.min(obj.left, obj.canvas.width - obj.getBoundingRect().width + obj.left - obj.getBoundingRect().left);
4715
+ obj.setCoords();
4722
4716
  }
4723
- if (obj.top - obj.height * obj.scaleY / 2 < 0) {
4724
- obj.top = offsetTop + obj.height * obj.scaleY / 2;
4717
+ var brNew = obj.getBoundingRect();
4718
+ if (brNew.width + brNew.left >= obj.canvas.width || brNew.height + brNew.top >= obj.canvas.height || brNew.left < 0 || brNew.top < 0) ; else {
4719
+ left1 = obj.left;
4720
+ top1 = obj.top;
4721
+ scale1x = obj.scaleX;
4722
+ scale1y = obj.scaleY;
4723
+ width1 = obj.width;
4724
+ height1 = obj.height;
4725
4725
  }
4726
- obj.setCoords();
4727
4726
  if (isObjectInCenter(e.target)) {
4728
4727
  use3dddPlus.getState().verticalLine.set({
4729
4728
  visible: true