diff --git a/resources/celerity/map.php b/resources/celerity/map.php index df61b63b29..510c2f0ddc 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -547,7 +547,6 @@ return array( 'rsrc/js/core/behavior-autofocus.js' => '7319e029', 'rsrc/js/core/behavior-badge-view.js' => '8ff5e24c', 'rsrc/js/core/behavior-choose-control.js' => '327a00d1', - 'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2', 'rsrc/js/core/behavior-dark-console.js' => 'f411b6ae', 'rsrc/js/core/behavior-detect-timezone.js' => '4c193c96', 'rsrc/js/core/behavior-device.js' => 'bb1dd507', @@ -655,7 +654,6 @@ return array( 'javelin-behavior-aphlict-listen' => 'fb20ac8d', 'javelin-behavior-aphlict-status' => '5e2634b9', 'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884', - 'javelin-behavior-aphront-crop' => 'fa0f4fc2', 'javelin-behavior-aphront-drag-and-drop-textarea' => '484a6e22', 'javelin-behavior-aphront-form-disable-on-submit' => '5c54cbf3', 'javelin-behavior-aphront-more' => 'a80d0378', @@ -2243,12 +2241,6 @@ return array( 'javelin-util', 'phabricator-busy', ), - 'fa0f4fc2' => array( - 'javelin-behavior', - 'javelin-dom', - 'javelin-vector', - 'javelin-magical-init', - ), 'fb20ac8d' => array( 'javelin-behavior', 'javelin-aphlict', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f4a7ba2fd3..794c7ca851 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -305,7 +305,6 @@ phutil_register_library_map(array( 'ConpherenceParticipantQuery' => 'applications/conpherence/query/ConpherenceParticipantQuery.php', 'ConpherenceParticipantView' => 'applications/conpherence/view/ConpherenceParticipantView.php', 'ConpherenceParticipationStatus' => 'applications/conpherence/constants/ConpherenceParticipationStatus.php', - 'ConpherencePicCropControl' => 'applications/conpherence/view/ConpherencePicCropControl.php', 'ConpherenceQueryThreadConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php', 'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php', 'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php', @@ -4782,7 +4781,6 @@ phutil_register_library_map(array( 'ConpherenceParticipantQuery' => 'PhabricatorOffsetPagedQuery', 'ConpherenceParticipantView' => 'AphrontView', 'ConpherenceParticipationStatus' => 'ConpherenceConstants', - 'ConpherencePicCropControl' => 'AphrontFormControl', 'ConpherenceQueryThreadConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod', 'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler', diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index dbcd02e50e..d807c2b4dd 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -506,10 +506,6 @@ final class ConpherenceUpdateController array( 'src' => $crop_uri, )))) - ->appendChild( - id(new ConpherencePicCropControl()) - ->setLabel(pht('Crop Image')) - ->setValue($image)) ->appendChild( id(new ConpherenceFormDragAndDropUploadControl()) ->setLabel(pht('Change Image'))); diff --git a/src/applications/conpherence/view/ConpherencePicCropControl.php b/src/applications/conpherence/view/ConpherencePicCropControl.php deleted file mode 100644 index 2cb869f93c..0000000000 --- a/src/applications/conpherence/view/ConpherencePicCropControl.php +++ /dev/null @@ -1,78 +0,0 @@ -getValue(); - - if ($file === null) { - return phutil_tag( - 'img', - array( - 'src' => PhabricatorUser::getDefaultProfileImageURI(), - ), - ''); - } - - $c_id = celerity_generate_unique_node_id(); - $metadata = $file->getMetadata(); - $scale = PhabricatorImageTransformer::getScaleForCrop( - $file, - $width, - $height); - - Javelin::initBehavior( - 'aphront-crop', - array( - 'cropBoxID' => $c_id, - 'width' => $width, - 'height' => $height, - 'scale' => $scale, - 'imageH' => $metadata[PhabricatorFile::METADATA_IMAGE_HEIGHT], - 'imageW' => $metadata[PhabricatorFile::METADATA_IMAGE_WIDTH], - )); - - return javelin_tag( - 'div', - array( - 'id' => $c_id, - 'sigil' => 'crop-box', - 'mustcapture' => true, - 'class' => 'crop-box', - ), - array( - javelin_tag( - 'img', - array( - 'src' => $file->getBestURI(), - 'class' => 'crop-image', - 'sigil' => 'crop-image', - ), - ''), - javelin_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => 'image_x', - 'sigil' => 'crop-x', - ), - ''), - javelin_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => 'image_y', - 'sigil' => 'crop-y', - ), - ''), - )); - } - -} diff --git a/webroot/rsrc/js/core/behavior-crop.js b/webroot/rsrc/js/core/behavior-crop.js deleted file mode 100644 index 272ccbeff8..0000000000 --- a/webroot/rsrc/js/core/behavior-crop.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @provides javelin-behavior-aphront-crop - * @requires javelin-behavior - * javelin-dom - * javelin-vector - * javelin-magical-init - */ - - JX.behavior('aphront-crop', function(config) { - - var dragging = false; - var startX, startY; - var finalX, finalY; - - var cropBox = JX.$(config.cropBoxID); - var basePos = JX.$V(cropBox); - cropBox.style.height = config.height + 'px'; - cropBox.style.width = config.width + 'px'; - var baseD = JX.$V(config.width, config.height); - - var image = JX.DOM.find(cropBox, 'img', 'crop-image'); - image.style.height = (config.imageH * config.scale) + 'px'; - image.style.width = (config.imageW * config.scale) + 'px'; - var imageD = JX.$V( - config.imageW * config.scale, - config.imageH * config.scale - ); - var minLeft = baseD.x - imageD.x; - var minTop = baseD.y - imageD.y; - - var ondrag = function(e) { - e.kill(); - dragging = true; - var p = JX.$V(e); - startX = p.x; - startY = p.y; - }; - - var onmove = function(e) { - if (!dragging) { - return; - } - e.kill(); - - var p = JX.$V(e); - var dx = startX - p.x; - var dy = startY - p.y; - var imagePos = JX.$V(image); - var moveLeft = imagePos.x - basePos.x - dx; - var moveTop = imagePos.y - basePos.y - dy; - - image.style.left = Math.min(Math.max(minLeft, moveLeft), 0) + 'px'; - image.style.top = Math.min(Math.max(minTop, moveTop), 0) + 'px'; - - // reset these; a new beginning! - startX = p.x; - startY = p.y; - - // save off where we are right now - imagePos = JX.$V(image); - finalX = Math.abs(imagePos.x - basePos.x); - finalY = Math.abs(imagePos.y - basePos.y); - JX.DOM.find(cropBox, 'input', 'crop-x').value = finalX; - JX.DOM.find(cropBox, 'input', 'crop-y').value = finalY; - }; - - var ondrop = function() { - if (!dragging) { - return; - } - dragging = false; - }; - - // NOTE: Javelin does not dispatch mousemove by default. - JX.enableDispatch(cropBox, 'mousemove'); - - JX.DOM.listen(cropBox, 'mousedown', [], ondrag); - JX.DOM.listen(cropBox, 'mousemove', [], onmove); - JX.DOM.listen(cropBox, 'mouseup', [], ondrop); - JX.DOM.listen(cropBox, 'mouseout', [], ondrop); - -});