@@ -104,26 +104,26 @@ public class WidgetFrame extends BaseDialog {
104104 private attribute initialScreenX;
105105 private attribute initialScreenY;
106106
107- private attribute saveInitialPos = function(stageX:Number, stageY:Number ):Void {
107+ private attribute saveInitialPos = function(screenX:Integer, screenY:Integer ):Void {
108108 initialX = x;
109109 initialY = y;
110110 initialWidth = widget.stage.width;
111111 initialHeight = widget.stage.height;
112- initialScreenX = stageX.intValue() + x ;
113- initialScreenY = stageY.intValue() + y ;
112+ initialScreenX = screenX ;
113+ initialScreenY = screenY ;
114114 }
115115
116116 private function mouseDelta(deltaFunction:function(a:Integer, b:Integer):Void):function(c:MouseEvent):Void {
117117 return function (e:MouseEvent):Void {
118- var xDelta = e.getStageX().intValue() + x - initialScreenX;
119- var yDelta = e.getStageY().intValue() + y - initialScreenY;
118+ var xDelta = e.getScreenX() - initialScreenX;
119+ var yDelta = e.getScreenY() - initialScreenY;
120120 deltaFunction(xDelta, yDelta);
121121 }
122122 }
123123
124124 private attribute startResizing = function(e:MouseEvent):Void {
125125 resizing = true;
126- saveInitialPos(e.getStageX(), e.getStageY());
126+ saveInitialPos(e.getStageX().intValue() + x , e.getStageY().intValue() + y );
127127 }
128128
129129 private attribute doneResizing = function(e:MouseEvent):Void {
@@ -342,39 +342,6 @@ public class WidgetFrame extends BaseDialog {
342342 stroke: Color.WHITESMOKE
343343 }
344344 ]
345- // onMousePressed: function(e) {
346- // if (e.getButton() == 1) {
347- // dragging = true;
348- // saveInitialPos(e.getStageX(), e.getStageY());
349- // }
350- // }
351- // onMouseDragged: function(e) {
352- // if (dragging and not docking) {
353- // var hoverOffset = [0, 0];
354- // for (container in WidgetContainer.containers) {
355- // var offset = container.hover(instance, e.getScreenX(), e.getScreenY(), e.getX(), e.getY(), true);
356- // if (offset != [0, 0]) {
357- // hoverOffset = offset;
358- // }
359- // }
360- // mouseDelta(function(xDelta:Integer, yDelta:Integer):Void {
361- // x = initialX + xDelta + hoverOffset[0];
362- // y = initialY + yDelta + hoverOffset[1];
363- // })(e);
364- // }
365- // }
366- // onMouseReleased: function(e) {
367- // if (e.getButton() == 1 and not docking) {
368- // dragging = false;
369- // for (container in WidgetContainer.containers) {
370- // var targetBounds = container.finishHover(instance, e.getScreenX(), e.getScreenY());
371- // if (targetBounds != null) {
372- // dock(targetBounds.x, targetBounds.y);
373- // }
374- // }
375- // instance.saveWithoutNotification();
376- // }
377- // }
378345 opacity: bind if (widget.resizable) rolloverOpacity * 0.8 else 0.0;
379346 }
380347 var slider = Slider {
@@ -447,6 +414,9 @@ public class WidgetFrame extends BaseDialog {
447414 }
448415 WidgetEventQueue.getInstance().registerInterceptor(window, EventInterceptor {
449416 public function shouldIntercept(event):Boolean {
417+ if (SwingUtilities.getDeepestComponentAt(event.getComponent(), event.getX(), event.getY()) == slider.getJComponent()) {
418+ return false;
419+ }
450420 if (event.getID() == java.awt.event.MouseEvent.MOUSE_ENTERED) {
451421 requestFocus(true);
452422 } else if (event.getID() == java.awt.event.MouseEvent.MOUSE_EXITED) {
@@ -455,13 +425,13 @@ public class WidgetFrame extends BaseDialog {
455425 //java.lang.System.out.println("pressed: {event.getComponent()}");
456426 if (event.getButton() == java.awt.event.MouseEvent.BUTTON1) {
457427 dragging = true;
458- saveInitialPos(event.getX (), event.getY ());
428+ saveInitialPos(event.getXOnScreen (), event.getYOnScreen ());
459429 }
460430 } else if (event.getID() == java.awt.event.MouseEvent.MOUSE_DRAGGED) {
461- if (not docking) {
431+ if (not docking and not resizing ) {
462432 if (not dragging) {
463433 dragging = true;
464- saveInitialPos(event.getX (), event.getY ());
434+ saveInitialPos(event.getXOnScreen (), event.getYOnScreen ());
465435 } else {
466436 var hoverOffset = [0, 0];
467437 for (container in WidgetContainer.containers) {
@@ -470,12 +440,12 @@ public class WidgetFrame extends BaseDialog {
470440 hoverOffset = offset;
471441 }
472442 }
473- x + = initialX + event.getX () - initialScreenX + hoverOffset[0];
474- y + = initialY + event.getY () - initialScreenY + hoverOffset[1];
443+ x = initialX + event.getXOnScreen () - initialScreenX + hoverOffset[0];
444+ y = initialY + event.getYOnScreen () - initialScreenY + hoverOffset[1];
475445 }
476446 }
477447 } else if (event.getID() == java.awt.event.MouseEvent.MOUSE_RELEASED) {
478- if (dragging and event.getButton() == java.awt.event.MouseEvent.BUTTON1 and not docking) {
448+ if (dragging and event.getButton() == java.awt.event.MouseEvent.BUTTON1 and not docking and not resizing ) {
479449 dragging = false;
480450 for (container in WidgetContainer.containers) {
481451 var targetBounds = container.finishHover(instance, event.getXOnScreen(), event.getYOnScreen());
@@ -489,88 +459,6 @@ public class WidgetFrame extends BaseDialog {
489459 return false;
490460 }
491461 });
492- // var glassPane = (window as RootPaneContainer).getGlassPane();
493- // glassPane.setVisible(true);
494- // var adapter = MouseInputAdapter {
495- // var activeComponent:Component;
496- // var overComponent:Component;
497- // public function mouseClicked(e) {
498- // redispatchMouseEvent(e);
499- // }
500- // public function mouseDragged(e) {
501- // redispatchMouseEvent(e);
502- // }
503- // public function mouseEntered(e) {
504- // requestFocus(true);
505- // }
506- // public function mouseExited(e) {
507- // mouseOverComponent(e, null);
508- // requestFocus(false);
509- // }
510- // public function mouseMoved(e) {
511- // mouseOverComponent(e, redispatchMouseEvent(e));
512- // }
513- // public function mousePressed(e) {
514- // activeComponent = redispatchMouseEvent(e);
515- // }
516- // public function mouseReleased(e) {
517- // redispatchMouseEvent(e);
518- // activeComponent = null;
519- // }
520- // public function mouseWheelMoved(e) {
521- // redispatchMouseEvent(e);
522- // }
523- // function mouseOverComponent(e:java.awt.event.MouseEvent, newComponent:Component) {
524- // if (overComponent != newComponent) {
525- // if (overComponent != null) {
526- // java.lang.System.out.println("exited: {overComponent}");
527- // var componentPoint = SwingUtilities.convertPoint(glassPane, e.getPoint(), overComponent);
528- // overComponent.dispatchEvent(new java.awt.event.MouseEvent(overComponent,
529- // java.awt.event.MouseEvent.MOUSE_EXITED,
530- // e.getWhen(),
531- // e.getModifiers(),
532- // componentPoint.x,
533- // componentPoint.y,
534- // e.getClickCount(),
535- // e.isPopupTrigger()));
536- // }
537- // if (newComponent != null) {
538- // java.lang.System.out.println("entered: {newComponent}");
539- // var componentPoint = SwingUtilities.convertPoint(glassPane, e.getPoint(), newComponent);
540- // newComponent.dispatchEvent(new java.awt.event.MouseEvent(newComponent,
541- // java.awt.event.MouseEvent.MOUSE_ENTERED,
542- // e.getWhen(),
543- // e.getModifiers(),
544- // componentPoint.x,
545- // componentPoint.y,
546- // e.getClickCount(),
547- // e.isPopupTrigger()));
548- // }
549- // overComponent = newComponent;
550- // }
551- // }
552- // function redispatchMouseEvent(e:java.awt.event.MouseEvent) {
553- // var glassPanePoint = e.getPoint();
554- // var contentPane = (window as RootPaneContainer).getContentPane();
555- // var containerPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, contentPane);
556- // var component = if (activeComponent != null) activeComponent else SwingUtilities.getDeepestComponentAt(contentPane, containerPoint.x, containerPoint.y);
557- // if (component != null) {
558- // var componentPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, component);
559- // component.dispatchEvent(new java.awt.event.MouseEvent(component,
560- // e.getID(),
561- // e.getWhen(),
562- // e.getModifiers(),
563- // componentPoint.x,
564- // componentPoint.y,
565- // e.getClickCount(),
566- // e.isPopupTrigger()));
567- // }
568- // return component;
569- // }
570- // }
571- // glassPane.addMouseListener(adapter);
572- // glassPane.addMouseMotionListener(adapter);
573- // glassPane.addMouseWheelListener(adapter);
574462 slider.getJSlider().addMouseListener(MouseAdapter {
575463 public function mousePressed(e) {
576464 changingOpacity = true;
0 commit comments