ctkVTKMagnifyView.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. // Qt includes
  15. #include <QEvent>
  16. #include <QMouseEvent>
  17. #include <QPointF>
  18. #include <QTimerEvent>
  19. // CTK includes
  20. #include "ctkVTKMagnifyView.h"
  21. #include "ctkVTKMagnifyView_p.h"
  22. #include "ctkLogger.h"
  23. // VTK includes
  24. #include <QVTKWidget.h>
  25. #include <vtkMath.h>
  26. #include <vtkRenderWindow.h>
  27. #include <vtkUnsignedCharArray.h>
  28. // STD includes
  29. #include <cmath>
  30. //--------------------------------------------------------------------------
  31. static ctkLogger logger("org.commontk.visualization.vtk.widgets.ctkVTKMagnifyView");
  32. //--------------------------------------------------------------------------
  33. // --------------------------------------------------------------------------
  34. // ctkVTKMagnifyViewPrivate methods
  35. // --------------------------------------------------------------------------
  36. ctkVTKMagnifyViewPrivate::ctkVTKMagnifyViewPrivate(ctkVTKMagnifyView& object)
  37. : QObject(&object), q_ptr(&object)
  38. {
  39. this->ObservedQVTKWidgets = QList<QVTKWidget *>();
  40. this->Magnification = 1.0;
  41. this->ObserveRenderWindowEvents = true;
  42. this->EventHandler.EventType = NoEvent;
  43. this->EventHandler.Position = QPointF(0,0);
  44. this->EventHandler.UpdateInterval = 20;
  45. this->EventHandler.TimerId = 0;
  46. }
  47. // --------------------------------------------------------------------------
  48. ctkVTKMagnifyViewPrivate::~ctkVTKMagnifyViewPrivate()
  49. {
  50. if (this->EventHandler.TimerId != 0)
  51. {
  52. this->killTimer(this->EventHandler.TimerId);
  53. }
  54. }
  55. // --------------------------------------------------------------------------
  56. void ctkVTKMagnifyViewPrivate::init()
  57. {
  58. // Start by removing the pixmap
  59. this->EventHandler.EventType = RemovePixmapEvent;
  60. this->removePixmap();
  61. // Start the timer
  62. this->restartTimer();
  63. }
  64. // --------------------------------------------------------------------------
  65. void ctkVTKMagnifyViewPrivate::restartTimer()
  66. {
  67. // Kill any old timers
  68. if (this->EventHandler.TimerId != 0)
  69. {
  70. this->killTimer(this->EventHandler.TimerId);
  71. this->EventHandler.TimerId = 0;
  72. }
  73. // Start timer if appropriate
  74. if (this->EventHandler.UpdateInterval != 0)
  75. {
  76. this->EventHandler.TimerId = this->startTimer(this->EventHandler.UpdateInterval);
  77. Q_ASSERT(this->EventHandler.TimerId);
  78. }
  79. // Not using any timers, process events as they come
  80. else
  81. {
  82. this->EventHandler.TimerId = 0;
  83. }
  84. }
  85. // --------------------------------------------------------------------------
  86. void ctkVTKMagnifyViewPrivate::resetEventHandler()
  87. {
  88. this->EventHandler.EventType = NoEvent;
  89. }
  90. // --------------------------------------------------------------------------
  91. void ctkVTKMagnifyViewPrivate::timerEvent(QTimerEvent * event)
  92. {
  93. Q_UNUSED(event);
  94. Q_ASSERT(event->timerId() == this->EventHandler.TimerId);
  95. if (this->EventHandler.EventType == UpdatePixmapEvent)
  96. {
  97. this->updatePixmap();
  98. }
  99. else if (this->EventHandler.EventType == RemovePixmapEvent)
  100. {
  101. this->removePixmap();
  102. }
  103. }
  104. // --------------------------------------------------------------------------
  105. void ctkVTKMagnifyViewPrivate::pushUpdatePixmapEvent()
  106. {
  107. if (this->EventHandler.Widget.isNull())
  108. {
  109. return;
  110. }
  111. this->pushUpdatePixmapEvent(
  112. this->EventHandler.Widget.data()->mapFromGlobal(QCursor::pos()));
  113. }
  114. // --------------------------------------------------------------------------
  115. void ctkVTKMagnifyViewPrivate::pushUpdatePixmapEvent(QPointF pos)
  116. {
  117. if (this->EventHandler.Widget.isNull())
  118. {
  119. return;
  120. }
  121. // Add this event to the queue
  122. this->EventHandler.EventType = UpdatePixmapEvent;
  123. this->EventHandler.Position = pos;
  124. // Process the event if we handle all events
  125. if (this->EventHandler.UpdateInterval == 0)
  126. {
  127. this->updatePixmap();
  128. }
  129. }
  130. // --------------------------------------------------------------------------
  131. void ctkVTKMagnifyViewPrivate::pushRemovePixmapEvent()
  132. {
  133. // Add this event to the queue
  134. this->EventHandler.EventType = RemovePixmapEvent;
  135. // Process the event if we handle all events
  136. if (this->EventHandler.UpdateInterval == 0)
  137. {
  138. this->removePixmap();
  139. }
  140. }
  141. // --------------------------------------------------------------------------
  142. void ctkVTKMagnifyViewPrivate::connectRenderWindow(QVTKWidget * widget)
  143. {
  144. Q_ASSERT(widget);
  145. Q_ASSERT(this->ObserveRenderWindowEvents);
  146. vtkRenderWindow * renderWindow = widget->GetRenderWindow();
  147. if (renderWindow)
  148. {
  149. this->qvtkConnect(renderWindow, vtkCommand::EndEvent,
  150. this, SLOT(pushUpdatePixmapEvent()));
  151. }
  152. }
  153. // --------------------------------------------------------------------------
  154. void ctkVTKMagnifyViewPrivate::disconnectRenderWindow(QVTKWidget * widget)
  155. {
  156. Q_ASSERT(widget);
  157. vtkRenderWindow * renderWindow = widget->GetRenderWindow();
  158. if (renderWindow)
  159. {
  160. this->qvtkDisconnect(renderWindow, vtkCommand::EndEvent,
  161. this, SLOT(pushUpdatePixmapEvent()));
  162. }
  163. }
  164. // --------------------------------------------------------------------------
  165. void ctkVTKMagnifyViewPrivate::observe(QVTKWidget * widget)
  166. {
  167. Q_ASSERT(widget);
  168. // If we are not already observing the widget, add it to the list and install
  169. // the public implementation as the event filter to handle mousing
  170. if (!this->ObservedQVTKWidgets.contains(widget))
  171. {
  172. this->ObservedQVTKWidgets.append(widget);
  173. Q_Q(ctkVTKMagnifyView);
  174. widget->installEventFilter(q);
  175. if (this->ObserveRenderWindowEvents)
  176. {
  177. this->connectRenderWindow(widget);
  178. }
  179. }
  180. }
  181. // --------------------------------------------------------------------------
  182. void ctkVTKMagnifyViewPrivate::remove(QVTKWidget * widget)
  183. {
  184. Q_ASSERT(widget);
  185. // If we are observing the widget, remove it from the list and remove the
  186. // public implementations event filtering
  187. if (this->ObservedQVTKWidgets.contains(widget))
  188. {
  189. Q_ASSERT(this->ObservedQVTKWidgets.count(widget) == 1);
  190. this->ObservedQVTKWidgets.removeOne(widget);
  191. Q_Q(ctkVTKMagnifyView);
  192. widget->removeEventFilter(q);
  193. if (this->ObserveRenderWindowEvents)
  194. {
  195. this->disconnectRenderWindow(widget);
  196. }
  197. }
  198. }
  199. // --------------------------------------------------------------------------
  200. void ctkVTKMagnifyViewPrivate::removePixmap()
  201. {
  202. Q_ASSERT(this->EventHandler.EventType == RemovePixmapEvent);
  203. Q_Q(ctkVTKMagnifyView);
  204. QPixmap nullPixmap;
  205. q->setPixmap(nullPixmap);
  206. q->update();
  207. this->resetEventHandler();
  208. }
  209. // -------------------------------------------------------------------------
  210. void ctkVTKMagnifyViewPrivate::updatePixmap()
  211. {
  212. Q_ASSERT(this->EventHandler.EventType == UpdatePixmapEvent);
  213. Q_ASSERT(!this->EventHandler.Widget.isNull());
  214. Q_Q(ctkVTKMagnifyView);
  215. // Retrieve buffer of given QVTKWidget from its render window
  216. vtkRenderWindow * renderWindow = this->EventHandler.Widget.data()->GetRenderWindow();
  217. if (!renderWindow)
  218. {
  219. return;
  220. }
  221. // Get the window size and mouse position, and do error checking
  222. QPointF pos = this->EventHandler.Position;
  223. int * windowSize = renderWindow->GetSize();
  224. QPointF mouseWindowPos(pos.x(), static_cast<double>(windowSize[1]-1)-pos.y());
  225. if (mouseWindowPos.x() < 0 || mouseWindowPos.x() >= windowSize[0] ||
  226. mouseWindowPos.y() < 0 || mouseWindowPos.y() >= windowSize[1])
  227. {
  228. return;
  229. }
  230. // Compute indices into the render window's data array
  231. // Given a magnification and the label's widget size, compute the number of
  232. // pixels we can show. We should round to get a larger integer extent, since
  233. // we will later adjust the pixmap's location in paintEvent().
  234. // Left-right and up-down are in the render window coordinate frame.
  235. // (which is different in the y-direction compared to Qt coordinates).
  236. QSizeF sizeToMagnify = QSizeF(q->size()) / this->Magnification;
  237. double posLeft = (mouseWindowPos.x() - ((sizeToMagnify.width()-1.0) / 2.0));
  238. double posRight = (mouseWindowPos.x() + ((sizeToMagnify.width()-1.0) / 2.0));
  239. double posBottom = (mouseWindowPos.y() - ((sizeToMagnify.height()-1.0) / 2.0));
  240. double posTop = (mouseWindowPos.y() + ((sizeToMagnify.height()-1.0) / 2.0));
  241. // Round to ints, for indexing into the pixel array
  242. int indexLeft = std::floor(posLeft);
  243. int indexRight = std::ceil(posRight);
  244. int indexBottom = std::floor(posBottom);
  245. int indexTop = std::ceil(posTop);
  246. // Handle when mouse is near the border
  247. int minLeft = 0;
  248. int maxRight = windowSize[0]-1;
  249. int minBottom = 0;
  250. int maxTop = windowSize[1]-1;
  251. bool overLeft = indexLeft < minLeft;
  252. bool overRight = indexRight > maxRight;
  253. bool overBottom = indexBottom < minBottom;
  254. bool overTop = indexTop > maxTop;
  255. // Ensure we don't access nonexistant indices
  256. if (overLeft)
  257. {
  258. indexLeft = minLeft;
  259. posLeft = minLeft;
  260. }
  261. if (overRight)
  262. {
  263. indexRight = maxRight;
  264. posRight = maxRight;
  265. }
  266. if (overBottom)
  267. {
  268. indexBottom = minBottom;
  269. posBottom = minBottom;
  270. }
  271. if (overTop)
  272. {
  273. indexTop = maxTop;
  274. posTop = maxTop;
  275. }
  276. // Error case
  277. if (indexLeft > indexRight || indexBottom > indexTop)
  278. {
  279. return;
  280. }
  281. // Setup the pixelmap's position in the label
  282. Qt::Alignment alignment;
  283. if (overLeft && !overRight)
  284. {
  285. alignment = Qt::AlignRight;
  286. }
  287. else if (overRight && !overLeft)
  288. {
  289. alignment = Qt::AlignLeft;
  290. }
  291. else
  292. {
  293. alignment = Qt::AlignLeft;
  294. }
  295. if (overBottom && !overTop)
  296. {
  297. alignment = alignment | Qt::AlignTop;
  298. }
  299. else if (overTop && !overBottom)
  300. {
  301. alignment = alignment | Qt::AlignBottom;
  302. }
  303. else
  304. {
  305. alignment = alignment | Qt::AlignTop;
  306. }
  307. q->setAlignment(alignment);
  308. // Retrieve the pixel data into a QImage (flip vertically to move from render
  309. // window coordinates to Qt coordinates)
  310. QSize actualSize(indexRight-indexLeft+1, indexTop-indexBottom+1);
  311. QImage image(actualSize.width(), actualSize.height(), QImage::Format_RGB32);
  312. vtkUnsignedCharArray * pixelData = vtkUnsignedCharArray::New();
  313. pixelData->SetArray(image.bits(), actualSize.width() * actualSize.height() * 4, 1);
  314. int front = renderWindow->GetDoubleBuffer();
  315. int success = renderWindow->GetRGBACharPixelData(
  316. indexLeft, indexBottom, indexRight, indexTop, front, pixelData);
  317. if (!success)
  318. {
  319. return;
  320. }
  321. pixelData->Delete();
  322. image = image.rgbSwapped();
  323. image = image.mirrored();
  324. // Scale the image to zoom, using FastTransformation to prevent smoothing
  325. QSize imageSize = actualSize * this->Magnification;
  326. image = image.scaled(imageSize, Qt::KeepAspectRatioByExpanding,
  327. Qt::FastTransformation);
  328. // Crop the magnified image to solve the problem of magnified partial pixels
  329. double errorLeft
  330. = (posLeft - static_cast<double>(indexLeft)) * this->Magnification;
  331. double errorRight
  332. = (static_cast<double>(indexRight) - posRight) * this->Magnification;
  333. double errorBottom
  334. = (posBottom - static_cast<double>(indexBottom)) * this->Magnification;
  335. double errorTop
  336. = (static_cast<double>(indexTop) - posTop) * this->Magnification;
  337. // When cropping the Qt image, the 'adjust' variables are in Qt coordinates,
  338. // not render window coordinates (bottom and top switch).
  339. int cropIndexLeft = vtkMath::Round(errorLeft);
  340. int cropIndexRight = imageSize.width() - vtkMath::Round(errorRight) - 1;
  341. int cropIndexTop = vtkMath::Round(errorTop);
  342. int cropIndexBottom = imageSize.height() - vtkMath::Round(errorBottom) - 1;
  343. // Handle case when label size and magnification are not both even or odd
  344. // (errorLeft/errorRight/errorBottom/errorTop will have fractional component,
  345. // so cropped image wouldn't be the correct size unless we adjust further).
  346. int requiredWidth = vtkMath::Round((posRight - posLeft + 1) * this->Magnification);
  347. int requiredHeight = vtkMath::Round((posTop - posBottom + 1) * this->Magnification);
  348. int actualWidth = cropIndexRight - cropIndexLeft + 1;
  349. int actualHeight = cropIndexBottom - cropIndexTop + 1;
  350. int diffWidth = requiredWidth - actualWidth;
  351. int diffHeight = requiredHeight - actualHeight;
  352. // Too wide
  353. if (diffWidth < 0 && cropIndexRight != imageSize.width()-1)
  354. {
  355. Q_ASSERT(actualWidth - requiredWidth <= 1);
  356. cropIndexRight += diffWidth;
  357. }
  358. // Too narrow
  359. else if (diffWidth > 0 && cropIndexLeft != 0)
  360. {
  361. Q_ASSERT(requiredWidth - actualWidth <= 1);
  362. cropIndexLeft -= diffWidth;
  363. }
  364. // Too tall
  365. if (diffHeight < 0 && cropIndexBottom != imageSize.height()-1)
  366. {
  367. Q_ASSERT(actualHeight - requiredHeight <= 1);
  368. cropIndexBottom += diffHeight;
  369. }
  370. // Too short
  371. else if (diffHeight > 0 && cropIndexTop != 0)
  372. {
  373. Q_ASSERT(requiredHeight - actualHeight <= 1);
  374. cropIndexTop -= diffHeight;
  375. }
  376. // Finally crop the QImage for display
  377. QRect cropRect(QPoint(cropIndexLeft, cropIndexTop),
  378. QPoint(cropIndexRight, cropIndexBottom));
  379. image = image.copy(cropRect);
  380. // Finally, set the pixelmap to the new one we have created and update
  381. q->setPixmap(QPixmap::fromImage(image));
  382. q->update();
  383. this->resetEventHandler();
  384. }
  385. //---------------------------------------------------------------------------
  386. // ctkVTKMagnifyView methods
  387. // --------------------------------------------------------------------------
  388. ctkVTKMagnifyView::ctkVTKMagnifyView(QWidget* parentWidget)
  389. : Superclass(parentWidget)
  390. , d_ptr(new ctkVTKMagnifyViewPrivate(*this))
  391. {
  392. Q_D(ctkVTKMagnifyView);
  393. d->init();
  394. }
  395. // --------------------------------------------------------------------------
  396. ctkVTKMagnifyView::~ctkVTKMagnifyView()
  397. {
  398. }
  399. // --------------------------------------------------------------------------
  400. CTK_GET_CPP(ctkVTKMagnifyView, double, magnification, Magnification)
  401. // --------------------------------------------------------------------------
  402. void ctkVTKMagnifyView::setMagnification(double newMagnification)
  403. {
  404. Q_D(ctkVTKMagnifyView);
  405. if (newMagnification == d->Magnification || newMagnification <= 0)
  406. {
  407. return;
  408. }
  409. d->Magnification = newMagnification;
  410. this->update();
  411. }
  412. // --------------------------------------------------------------------------
  413. CTK_GET_CPP(ctkVTKMagnifyView, bool,
  414. observeRenderWindowEvents, ObserveRenderWindowEvents)
  415. // --------------------------------------------------------------------------
  416. void ctkVTKMagnifyView::setObserveRenderWindowEvents(bool newObserve)
  417. {
  418. Q_D(ctkVTKMagnifyView);
  419. if (newObserve == d->ObserveRenderWindowEvents)
  420. {
  421. return;
  422. }
  423. d->ObserveRenderWindowEvents = newObserve;
  424. // Connect/disconnect observations on vtkRenderWindow EndEvents, depending
  425. // on whether we are switching from not-observing to observing or from
  426. // observing to not-observing
  427. QList<QVTKWidget *>::iterator it = d->ObservedQVTKWidgets.begin();
  428. while (it != d->ObservedQVTKWidgets.end())
  429. {
  430. if (newObserve)
  431. {
  432. d->connectRenderWindow(*it);
  433. }
  434. else
  435. {
  436. d->disconnectRenderWindow(*it);
  437. }
  438. ++it;
  439. }
  440. }
  441. // --------------------------------------------------------------------------
  442. int ctkVTKMagnifyView::updateInterval() const
  443. {
  444. Q_D(const ctkVTKMagnifyView);
  445. return d->EventHandler.UpdateInterval;
  446. }
  447. // --------------------------------------------------------------------------
  448. void ctkVTKMagnifyView::setUpdateInterval(int newInterval)
  449. {
  450. Q_D(ctkVTKMagnifyView);
  451. if (newInterval == d->EventHandler.UpdateInterval || newInterval < 0)
  452. {
  453. return;
  454. }
  455. d->EventHandler.UpdateInterval = newInterval;
  456. d->restartTimer();
  457. }
  458. // --------------------------------------------------------------------------
  459. void ctkVTKMagnifyView::observe(QVTKWidget * widget)
  460. {
  461. Q_D(ctkVTKMagnifyView);
  462. if (widget)
  463. {
  464. d->observe(widget);
  465. }
  466. }
  467. // --------------------------------------------------------------------------
  468. void ctkVTKMagnifyView::observe(QList<QVTKWidget *> widgets)
  469. {
  470. foreach(QVTKWidget * widget, widgets)
  471. {
  472. this->observe(widget);
  473. }
  474. }
  475. // --------------------------------------------------------------------------
  476. bool ctkVTKMagnifyView::isObserved(QVTKWidget * widget) const
  477. {
  478. if (!widget)
  479. {
  480. return false;
  481. }
  482. Q_D(const ctkVTKMagnifyView);
  483. return d->ObservedQVTKWidgets.contains(widget);
  484. }
  485. // --------------------------------------------------------------------------
  486. int ctkVTKMagnifyView::numberObserved() const
  487. {
  488. Q_D(const ctkVTKMagnifyView);
  489. return d->ObservedQVTKWidgets.length();
  490. }
  491. // --------------------------------------------------------------------------
  492. bool ctkVTKMagnifyView::hasCursorInObservedWidget()const
  493. {
  494. Q_D(const ctkVTKMagnifyView);
  495. // checking underMouse is faster than
  496. // QApplication::widgetAt(QCursor::pos())
  497. foreach(const QVTKWidget* widget, d->ObservedQVTKWidgets)
  498. {
  499. if (widget->underMouse())
  500. {
  501. return true;
  502. }
  503. }
  504. return false;
  505. }
  506. // --------------------------------------------------------------------------
  507. void ctkVTKMagnifyView::remove(QVTKWidget * widget)
  508. {
  509. Q_D(ctkVTKMagnifyView);
  510. if (widget)
  511. {
  512. d->remove(widget);
  513. }
  514. }
  515. // --------------------------------------------------------------------------
  516. void ctkVTKMagnifyView::remove(QList<QVTKWidget *> widgets)
  517. {
  518. foreach(QVTKWidget * widget, widgets)
  519. {
  520. this->remove(widget);
  521. }
  522. }
  523. // --------------------------------------------------------------------------
  524. bool ctkVTKMagnifyView::eventFilter(QObject * obj, QEvent * event)
  525. {
  526. // The given object should be a QVTKWidget in our list
  527. QVTKWidget * widget = static_cast<QVTKWidget *>(obj);
  528. Q_ASSERT(widget);
  529. Q_D(ctkVTKMagnifyView);
  530. Q_ASSERT(d->ObservedQVTKWidgets.contains(widget));
  531. d->EventHandler.Widget = widget;
  532. QEvent::Type eventType = event->type();
  533. // On mouse move, update the pixmap with the zoomed image
  534. if (eventType == QEvent::MouseMove)
  535. {
  536. QMouseEvent * mouseEvent = static_cast<QMouseEvent *>(event);
  537. Q_ASSERT(mouseEvent);
  538. #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
  539. d->pushUpdatePixmapEvent(mouseEvent->localPos());
  540. #else
  541. d->pushUpdatePixmapEvent(mouseEvent->posF());
  542. #endif
  543. }
  544. // On enter, update the pixmap with the zoomed image (required for zooming when
  545. // widget is created with mouse already within it), and emit signal of enter event
  546. else if (eventType == QEvent::Enter)
  547. {
  548. d->pushUpdatePixmapEvent();
  549. emit enteredObservedWidget(widget);
  550. }
  551. // On leave, fill the pixmap with a solid color and emit signal of leave event
  552. else if (eventType == QEvent::Leave)
  553. {
  554. d->pushRemovePixmapEvent();
  555. emit leftObservedWidget(widget);
  556. }
  557. return this->Superclass::eventFilter(obj, event);
  558. }